I don't want my identity column to show up in my datagrid. How do I control which columns I want visible and which ones I don't?
Printable View
I don't want my identity column to show up in my datagrid. How do I control which columns I want visible and which ones I don't?
From a site:
Some developers have reported problems controlling the visibility of columns in the DataGrid control. The problem usually comes down to one fact. The DataGrid has a property called AutoGenerateColumns. The default value is "True". This means that when AutoGenerateColumns is set to True, the DataGrid will pull its column headings straight from the column names of the database table. If you allow this to happen you cannot control the visibility of the columns.
U can control the columns to be seen or not seen using the following code:
DataGrid1.Columns(0).Visible=False
This makes the first column invisible.