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.
NR
Nirmal Raja
Syncfusion Team
March 18, 2010 09:01 PM UTC
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