468,321 Members | 1,733 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

Hiding Columns

Hi Al

Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this

TI
Kevin
Nov 15 '05 #1
2 1883
If this is for an ASP.NET DataGrid ( you didn't say in your post), then here
is the text straight from out of the help collection:

Use the DataGridColumnCollection to programmatically manage a collection of
DataGridColumn derived column objects. These objects represent the columns
in a DataGrid control. You can add, remove, or insert columns into the
DataGridColumnCollection.

Note When the AutoGenerateColumns property is set to true, the columns
created by the DataGrid control are not added to the Columns collection.
The DataGrid control does not store the contents of its Columns collection
into the view state. To add or remove a column dynamically, you must
programmatically add or remove the column everytime the page is refreshed.
Provide a Page_Init function that adds or removes the column before the
DataGrid control's state is reload and the control is rebuilt. Otherwise,
the changes to the Columns collection are not reflected in the DataGrid
control when it is displayed.

Note Although you can programmatically add columns to or remove columns
from the Columns collection of the DataGrid control, it is easier to list
the columns statically and then use the Visible property to display or hide
each column.
The order of the columns in the collection determines the order that the
columns are displayed in the DataGrid control.

The following table lists the different column classes that derive from the
DataGridColumn class. .......

Peter

"Kevin" <an*******@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
Hi All

Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific
columns, how do I do this?
TIA
Kevin

Nov 15 '05 #2
Kevin wrote:
Hi All

Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this?

If windows forms, get the grid table style, drill down to the
appropriate column style, and set its width to 0!

/steveA
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by c.anandkumar | last post: by
4 posts views Thread by Alan Seunarayan | last post: by
2 posts views Thread by MrNobody | last post: by
5 posts views Thread by Rich | last post: by
5 posts views Thread by srinivas | last post: by
1 post views Thread by jack | last post: by
2 posts views Thread by =?Utf-8?B?SmF5IFBvbmR5?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.