S4E

S4E

  • NA
  • 33
  • 0

Limiting Columns shown in a DataGrid?

Oct 15 2004 7:52 AM
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.

Answers (4)