PopulateHeaders and PopulateValues problems

I''ve looked at previous posts regarding these methods and I have finally worked out that PopulateValues requires a 2-dimensional array as a datasource. I''m still having trouble with PopulateHeaders though. It appears to accept a 1-dimensional array. When I pass it such an array only the first column header is populated with the text ''Value''. What am I doing wrong? Here is my code: private GridControl grdTransactions; string[] headers ={"trans","count","min","max","mean"}; grdTransactions.Cols.Hidden[0] = true; grdTransactions.Rows.Hidden[0] = true; grdTransactions.Rows.HeaderCount = 1; grdTransactions.ColCount = 5; grdTransactions.PopulateHeaders(GridRangeInfo.Cells(1,1,1,5), headers);

1 Reply

AD Administrator Syncfusion Team July 2, 2004 12:44 PM UTC

The PopulateHeaders will not handle setting values in column headers. You can use code like this to set values in the headers without triggering events.
string[] headers ={"trans","count","min","max","mean"};
int row = 1;
int col = 1;
foreach(string s in headers)
{
	GridStyleInfo style = new GridStyleInfo();
	style.Text = s;
	this.gridControl1.SetCellInfo(row, col, style, Syncfusion.Styles.StyleModifyType.Override, true, false); 
	col++;
}

Loader.
Up arrow icon