Hide Datagrid columns

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

    #1

    Hide Datagrid columns

    I have a dataset with two tables.

    I make data view of each table, connect the parent table to one data grid
    and the child table to the other datagrid, with a row filter, that gets set
    when a user clicks a row in the parent.

    I have PK/FK in the tables to know what to display.

    I want to hide the PK/FK columns in the U/I, but still use them.

    I can't seem to find a way to do this.

    Any help would be appreciated.

    Thanks,

    Shane


  • Chris

    #2
    Re: Hide Datagrid columns

    Shane Story wrote:[color=blue]
    > I have a dataset with two tables.
    >
    > I make data view of each table, connect the parent table to one data grid
    > and the child table to the other datagrid, with a row filter, that gets set
    > when a user clicks a row in the parent.
    >
    > I have PK/FK in the tables to know what to display.
    >
    > I want to hide the PK/FK columns in the U/I, but still use them.
    >
    > I can't seem to find a way to do this.
    >
    > Any help would be appreciated.
    >
    > Thanks,
    >
    > Shane
    >
    >[/color]

    You have to assign a DataGridTableSt yle to the datagrid. Then when you
    attach the DataSource only columns that have a DataGridColumnS tyle will
    be shown but you can still access the other column from the datasource.

    Hope this helps.

    Chris

    Comment

    • Mythran

      #3
      Re: Hide Datagrid columns


      "Shane Story" <sstoryREMOVETH IS at lburgus dot com> wrote in message
      news:ejBSQV3lFH A.936@TK2MSFTNG P09.phx.gbl...[color=blue]
      >I have a dataset with two tables.
      >
      > I make data view of each table, connect the parent table to one data grid
      > and the child table to the other datagrid, with a row filter, that gets
      > set
      > when a user clicks a row in the parent.
      >
      > I have PK/FK in the tables to know what to display.
      >
      > I want to hide the PK/FK columns in the U/I, but still use them.
      >
      > I can't seem to find a way to do this.
      >
      > Any help would be appreciated.
      >
      > Thanks,
      >
      > Shane
      >
      >[/color]

      Is this ASP.Net or WinForms? Not sure how to do the equivalent in WinForms,
      but in ASP.Net you would handle the DataGrid_DataIt emBound event. Check to
      see if e.Item.ItemType is the type you want to mess with, then convert
      e.Item.DataItem .Row to your DataRow. That would give you all values for the
      DataItem that was bound.

      HTH,
      Mythran

      Comment

      • Shane Story

        #4
        Re: Hide Datagrid columns

        It is a Win forms app. I already have it doing this... just have problems
        because I need to hide columns and the one I need to hide is the PK in the
        parent that I need to use for hidden FK in the child.
        "Mythran" <kip_potter@hot mail.comREMOVET RAIL> wrote in message
        news:uyVXSs3lFH A.2080@TK2MSFTN GP14.phx.gbl...[color=blue]
        >
        > "Shane Story" <sstoryREMOVETH IS at lburgus dot com> wrote in message
        > news:ejBSQV3lFH A.936@TK2MSFTNG P09.phx.gbl...[color=green]
        > >I have a dataset with two tables.
        > >
        > > I make data view of each table, connect the parent table to one data[/color][/color]
        grid[color=blue][color=green]
        > > and the child table to the other datagrid, with a row filter, that gets
        > > set
        > > when a user clicks a row in the parent.
        > >
        > > I have PK/FK in the tables to know what to display.
        > >
        > > I want to hide the PK/FK columns in the U/I, but still use them.
        > >
        > > I can't seem to find a way to do this.
        > >
        > > Any help would be appreciated.
        > >
        > > Thanks,
        > >
        > > Shane
        > >
        > >[/color]
        >
        > Is this ASP.Net or WinForms? Not sure how to do the equivalent in[/color]
        WinForms,[color=blue]
        > but in ASP.Net you would handle the DataGrid_DataIt emBound event. Check[/color]
        to[color=blue]
        > see if e.Item.ItemType is the type you want to mess with, then convert
        > e.Item.DataItem .Row to your DataRow. That would give you all values for[/color]
        the[color=blue]
        > DataItem that was bound.
        >
        > HTH,
        > Mythran
        >[/color]


        Comment

        • Cor Ligthert [MVP]

          #5
          Re: Hide Datagrid columns

          Shane,

          Did you already have a look at our website, it is based on VBNet and has a
          lot of samples for the Datagrid.



          I hope this helps,

          Cor


          Comment

          • Shane Story

            #6
            Re: Hide Datagrid columns

            Thanks for the link.

            "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
            news:%23YR2pF4l FHA.2916@TK2MSF TNGP14.phx.gbl. ..[color=blue]
            > Shane,
            >
            > Did you already have a look at our website, it is based on VBNet and has a
            > lot of samples for the Datagrid.
            >
            > http://www.windowsformsdatagridhelp.com/default.aspx
            >
            > I hope this helps,
            >
            > Cor
            >
            >[/color]


            Comment

            Working...