Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
495
Setting a UnboundCheckBoxField through Javascript
posted

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

Parents
No Data
Reply
  • 33839
    Suggested Answer
    posted

    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 

Children