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.
Unfortunately, activation email could not send to your email. Please try again.

Can not PopulateValue on a specific Row?

Thread ID:

Created:

Updated:

Platform:

Replies:

9447 Dec 18,2003 02:43 AM Dec 18,2003 04:51 AM Windows Forms 1
loading
Tags: GridControl
Numan Günes
Asked On December 18, 2003 02:43 AM

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?

Administrator [Syncfusion]
Replied On December 18, 2003 04:51 AM

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;
		}
	}
} 

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;