Limiting Columns shown in a DataGrid?
Folks, if you have a dataSet that has 5 columns for example, is there a way to show the DataSet in a DataGrid, but limit which columns are shown?
DataSet ds = some stored procedure call;
myDataGrid.dataSource = ds;
Essentially I still want to be able to access data in all columns but only want some columns to show - is the doable?
E.g. I might hide column[0] but still want to access its value if the user hilights a row in my DataGrid with code like:
string HiddenColumnValue = myDataGrid[myDataGrid.CurrentCell.RowNumber, 0] // gets column0's value for this row.
(I've seen the ADO.NET view classes which let you control the rows coming back by providing filters, but I dont think they allow you to control the columns.)
Thanks.
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Andrzej WegierskiRank #1,729 · 877 reputationPosted Oct 15, 2004, 10:40 PM EDT
aeroswan18 reputationPosted Oct 27, 2004, 6:52 PM EDT
Andrzej WegierskiRank #1,729 · 877 reputationPosted Oct 28, 2004, 2:54 AM EDT
Bloopy25 reputationPosted Dec 19, 2004, 3:00 PM EST