LS
Lingaraj S
Syncfusion Team
July 21, 2009 09:44 AM UTC
Hi Stephen,
Thank you for your interest in Syncfusion product.
The PopulateHeader method used to populate the Header depends upon the DataSource.
Refer the example code below:
// BindingListDatsource
IList list = new List();
for (int i = 1; i <=100; i++)
{
list.Add(new Foo("Syncfusion","Syncfusion"));
}
foos = new BindingList(list);
GridB.RowCount = foos.Count;
GridB.ColCount = 2;
GridB.PopulateHeaders(GridRangeInfo.Cells(0, 1, 0, 2), foos);
GridB.PopulateValues(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount), foos);
// DataTable DataSource
DataTable dt = GetTable();
GridB.RowCount = dt.Rows.Count;
GridB.ColCount = dt.Columns.Count+1;
GridB.PopulateHeaders(GridRangeInfo.Cells(0, 1, 0, dt.Columns.Count), dt);
GridB.PopulateValues(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount), dt);
If you want to set the HeaderText in GridControl, then please try using Text porperty in GridStyleInfo to achieve this behavior.
Refer the code below:
GridB[0,1].Text="Header1"; // Set the Header text for First header cell
GridB[0,2].Text="Header2";
Please let me know if you have any queries.
Regards,
Lingaraj S.