Hi -
I've got an UnboundCheckBoxField as a column in a WebDataGrid. I want to use this to track edits to the grid row. I am capturing the CellValueChanging event and calling my javascript function to then set the value of the check box for that row. I am able to use the cell._setCheckState(true); to set the check state of the cell, but if I try to do cell.set_value(true); I get an overflow error.
If I only do the _setCheckState(true), the checkbox displays correctly, but when I loop through the rows collection in the code behind during a post back, the cell value is false. Oddly enough, if I actually click on my check box in the grid and trigger a post back, the cell value is true. There's got to be a way to set the value of that check box through Javascript so that the value is set just as if it was clicked on, but beats me if I can figure it out.
Thanks,
Jeff Balcerzak
Hi Jeff,
This happens because you call set_value in cellValueChanging client event. When you call set_value, it triggers that same event, so you get an overflow error. You could either switch to handling cellValueChanged or cell._set_value_internal(true, 1).
regards,David Young
Actually on second thought, the same overflow might happen if you use set_value in the changed event. You might need a flag in your event to check the key. If the key is the unboudn checkbox key, do not call set_value on that cell. That should fix the recursion problem.
-David Young