HA
haneefm
Syncfusion Team
June 6, 2007 06:33 PM UTC
Hi Nedu,
The TableControlCheckBoxClick is the event that gets triggered only when user clicks using the mouse on the checker box of checkbox cell. You can catch the TableControlCurrentCellChanged event for detecting any changes made to the checkbox cell. If the update fails, then you can set cell value using the CurrentRecord.SetValue method in a grid. Below is a code snippet
void grid_TableControlCurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "CheckBox")
{
Console.WriteLine("CheckBox cell( {0},{1})=> {2}", cc.RowIndex, cc.ColIndex, e.TableControl.GetTableViewStyleInfo(cc.RowIndex,cc.ColIndex).CellValue );
if( updateFails )
{
e.TableControl.Table.CurrentRecord.SetValue("CheckBox",false);
e.TableControl.Table.CurrentRecord.EndEdit();
}
}
}
Best regards,
Haneef
CH
Chinedu
June 6, 2007 08:25 PM UTC
Thanks Haneef,
How do I get the original checkstate of the checkbox, if the server update fails, I want to stop the change from going thru.
For instance, lets say the checkbox has a value of [True or Checked], a user clicks on it to change it to [False or UnChecked], I capture that click event and update the server with the new value, which would be [False or UnChecked] now and all is fine
However, if the update to the server fails, I want to keep the original value of the checkbox which is [True or Checked] in this case...