We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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 07:44 AM

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.
Live Chat Icon For mobile
Up arrow icon