I''m using a data bound grid to display a DataTable. Is it possible (in Beta 2) to display automatically the default row and column headers (ie "A", "B", "C",... for the columns, "1", "2", "3", ... for the rows) in addition to the headers added by the DataBound Grid?
ADAdministrator Syncfusion Team March 9, 2004 06:55 AM
Do you want a second row of column header (and second column of row headers), or do you want to combine the desired text into a single header (maybe A-MyColumn 1, B-MyColumn2 etc).
If you want two header rows, then you can set
this.grid.Model.Rows.HeaderCount = 1;
this.grid,Model.Rows.FrozenCount = 1;
Then in aPrepareViewStyleInfo event handler, based on the value of e.ColIndex, you could explicitly set the e.Style.Text when e.RowIndex was 0 or 1. To convert e.ColIndex to a letter of the alphabet, you can call the static (Shared in VB) member GridRangeInfo.GetAlphaLabel method.
Here is a little sample to give you the flavor of the kinds of things you can do.
SJSamuel JackMarch 10, 2004 08:58 AM
Thanks for that, it seems to work fine.
What about for the Row Headers?
I want to have numbers 1, 2,3, ... down the side of the grid.
ADAdministrator Syncfusion Team March 10, 2004 09:34 AM
If you are handling PrepareViewStyleInfo as in the prevoius sample, you can add this else clause to the if to get teh numbers down the side.
else if(e.ColIndex == 0 && e.RowIndex > 0)
e.Style.CellType = "Header";
e.Style.Text = e.RowIndex.ToString();
e.Style.Font.Bold = false;