By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,712 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,712 IT Pros & Developers. It's quick & easy.

Hide Datagrid columns

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies

P: n/a
Shane Story wrote:
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


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

Hope this helps.

Chris
Nov 21 '05 #2

P: n/a

"Shane Story" <sstoryREMOVETHIS at lburgus dot com> wrote in message
news:ej*************@TK2MSFTNGP09.phx.gbl...
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


Is this ASP.Net or WinForms? Not sure how to do the equivalent in WinForms,
but in ASP.Net you would handle the DataGrid_DataItemBound 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

Nov 21 '05 #3

P: n/a
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" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:uy**************@TK2MSFTNGP14.phx.gbl...

"Shane Story" <sstoryREMOVETHIS at lburgus dot com> wrote in message
news:ej*************@TK2MSFTNGP09.phx.gbl...
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
Is this ASP.Net or WinForms? Not sure how to do the equivalent in

WinForms, but in ASP.Net you would handle the DataGrid_DataItemBound 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

Nov 21 '05 #4

P: n/a
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
Nov 21 '05 #5

P: n/a
Thanks for the link.

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.