I'm trying to create a databound grid which uses a DataTable as its DataSource (ie. grid.DataSource = myDataTable;).
It's a readonly grid BTW, no edits allowed.
I'd like to somehow make the grid's row header text be the values of my DataTable's column 0 values. The default behavior seems to be that the grid uses column 0 for a row header and column 1 for the first DataTable column.
I've managed to do what I want by hiding the grid's column 1 and in the PrepareViewStyleInfo handler I copy the contents of column 1 to column 0 (the row header) for each row. This seems like a huge hack.
Is there a more elegant way of forcing the DataBoundGrid to use my DataTable's first column as the row header values?
Any insights appreciated.
ADAdministrator Syncfusion Team September 16, 2003 11:43 AM
Here is something to try. Hide the default row header (col 0). Then set:
this.grid.Model.Cols.FrozenCount = 1;
This should prevent your column 1 from scrolling and it should just display your column 1 values as a fixed column. If you want the cell to appear like a header cell, then set:
this.grid.Binder.InternalColumns.StyleInfo.CellType = "Header";