Checkbox in cell click is not returning correct state

I am handling the GridCellClickEventHandler. While debugging, I noticed this event fires before the checkbox click takes effect, for e.g. if the original state was checked, the state value when stepping into this function is still true, although, the click would have set the value to false.

Am I supposed to reverse this logic or is there a better way of doing this?

Thanks

1 Reply

HA haneefm Syncfusion Team October 10, 2007 02:52 PM UTC

Hi Ashes,

The reason is that the CheckBoxClick is raised just before the value of the current cell is changed. Try handling the CurrentCellChanged event. This is raised after the value has been updated. In the CurrentCellChanged event, you can access the underlying style value with grid.Model[CurrentCell.RowIndex, CurrentCell.ColIndex].CellValue.Here is code snippet

private void grid_CurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = this.grid.CurrentCell;
GridStyleInfo style = this.grid.Model[cc.RowIndex, cc.ColIndex];
if(style.CellType == "CheckBox")
{
Console.WriteLine(style.CellValue);
}
}

Best regards,
Haneef

Loader.
Up arrow icon