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.

Programmatically set cell value and save it to data source

Thread ID:

Created:

Updated:

Platform:

Replies:

93341 Mar 10,2010 05:46 AM Mar 18,2010 05:01 PM Windows Forms 1
loading
Tags: GridControl
shi zhangjue
Asked On March 10, 2010 05:46 AM

I want to programmatically set a value to certain cell in GDBG, with below code,

for (int i=1; i<5; i++)
{
//this.gridDataBoundGrid1.CurrentCell.MoveTo(i, 1);
//this.gridDataBoundGrid1.CurrentCell.BeginEdit();
this.gridDataBoundGrid1[i, 1].CellValue = i;
//this.gridDataBoundGrid1.CurrentCell.EndEdit();
}

the result is:
this.gridDataBoundGrid1[1,1] = 4; // Strange!
this.gridDataBoundGrid1[2,1] = 2;
this.gridDataBoundGrid1[3,1] = 3;
this.gridDataBoundGrid1[4,1] = 4;

uncomment the code, the result is correct:

this.gridDataBoundGrid1[1,1] = 1; // Correct
this.gridDataBoundGrid1[2,1] = 2;
this.gridDataBoundGrid1[3,1] = 3;
this.gridDataBoundGrid1[4,1] = 4;

Is it too heavy to set a value to cell? What's the correct way to set cell value and save it to data source.



Nirmal Raja [Syncfusion]
Replied On March 18, 2010 05:01 PM

Hi,

The essential way to set a value to the grid cell is by calling the BeginEdit before editing and EndEdit after the cell has been edited. These methods are to notify the grid that the current cell is on the edit and not ondraw. There won't be any performance issue to load the data's with the BeginEdit and EndEdit.

Let me know if you have any queries.

Regards,
Nirmal

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.

;