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

Can not PopulateValue on a specific Row?

My code is this : gridControl1.BeginUpdate(); string[] strArray = new string[]{"a","b","c","d","e","f","g"}; grdiControl1.Model.PopulateValues(GridRangeInfo.Row(1),strArray); gridControl1.EndUpdate(); gridControl1.Refresh(); but in control grid, only populate to cell(1,0) value "a". But I want populate array values to all columns(have 7 columns) of 1st row. how can i do?

1 Reply

AD Administrator Syncfusion Team December 18, 2003 09:51 AM UTC

The PopulateValues method moves down the columns and not across the rows. If you want to use some other loop order, then you can write your own populate method, and access the GridData object directly to gain speed over using indexers directly on the GridControl object. This way, you can control exactly the order your data is processed. Here is a little method that tries to populate a single row with values in a string array (which is what I think your sample code was trying to do.)
private void PopulateRow(int row, string[] strArray)
	//make sure you don''t exceed grid or array bounds
	int count = strArray.GetLength(0);
	if(count >= this.gridControl1.ColCount)
	count = this.gridControl1.ColCount - 1;
	if(count > 0)
		GridData data = this.gridControl1.Data;
		for(int i = 0; i < count; ++i)
			GridStyleInfo style = new GridStyleInfo();
			style.CellValue = strArray[i];
			data[row, i + 1] = style.Store;

Live Chat Icon For mobile
Up arrow icon