Datagrid TableStyles question...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • johnb41

    #1

    Datagrid TableStyles question...

    I'm attempting to display a datagrid with an EXTRA column: a checkbox
    column. I successfully added it by creating a DataGridBoolCol umn:

    Dim ts1 As New DataGridTableSt yle
    ts1.MappingName = "Archive"
    Dim colDiscontinued As New DataGridBoolCol umn
    With colDiscontinued
    .MappingName = "abc"
    .HeaderText = "xyz"
    .Width = 80
    End With
    ts1.GridColumnS tyles.Add(colDi scontinued)
    DataGrid1.Table Styles.Add(ts1)

    This works. BUT the resulting Datagrid ONLY shows this checkbox
    column. I want this column to show up in addition to all the default
    columns. Do I have to write code to show all the other columns, or is
    there a simple way?

    Also, I don't want to MAP this checkbox column with anything. I just
    need checkboxes to show up next to each column for the user to click
    on. Then i'll write code to determine what rows were selected and then
    do something with them. If i leave the .Mappingname property blank,
    the column just disappears. Any help/advice for this?

    Thanks so much for all your help!
    John

  • Cor Ligthert

    #2
    Re: Datagrid TableStyles question...

    John,

    The answer on the first question is yes, you need to set for all columns
    styles, if you use one.

    The second questions. The name of the datagrid is "datagrid" and not grid,
    because it uses underlaying data.

    There is no simple Grid as control in the Windowsform part of Net. However
    I don't see your problem, accessing a column in a datatable is very easy and
    when you need an empty one, you just add an extra one to your table.

    DataTable.Colum ns.add("myBool" ,Gettype(system .Boolean))

    I hope this helps,

    Cor


    Comment

    • johnb41

      #3
      Re: Datagrid TableStyles question...

      Cor,

      Thanks for the info. The problem for me is that datatable.colum ns.add
      adds a column to the "end". I really need it before all the columns.

      I'm assuming that if I do this, I can then create a tablestyle where I
      create all the columns, and just put the checkbox column at the
      beginning. I'll try this out!

      Thanks!
      John

      Comment

      • Cor Ligthert

        #4
        Re: Datagrid TableStyles question...

        John,
        [color=blue]
        >
        > Thanks for the info. The problem for me is that datatable.colum ns.add
        > adds a column to the "end". I really need it before all the columns.
        >
        > I'm assuming that if I do this, I can then create a tablestyle where I
        > create all the columns, and just put the checkbox column at the
        > beginning. I'll try this out!
        >[/color]
        Therefore are the columnstyles they are used in your grid in the sequence as
        you add them them to the styles. I really don't know how to make a decent
        datagrid without the styles.

        I hope this helps,

        Cor


        Comment

        • johnb41

          #5
          Re: Datagrid TableStyles question...

          Helps alot, thanks! I just find this very complicated because I have
          more experience w/ asp.net datagrids, which I think make much more
          sense to me. I wish both types of datagrids worked more similarly. Oh
          well. Thanks again!

          John

          Comment

          Working...