I am using the new BoundCheckBoxField and I want it to postback each time the checkbox is clicked so I can update the database.
Is this possible?
I really don't want to have an "update" button anywhere and this is the ONLY column in the grid that is editable.
Hi,
I handled the RowUpdating server event and had the following code.
function valueChanged(grid, args)
{
var cell = args.get_cell();
if (cell.get_column().get_key() == "IsActive")
var editingCore = grid.get_behaviors().get_editingCore();
editingCore.commit();
}
<EditingClientEvents CellValueChanged="valueChanged" />
What did you do? Could you attach some code or a sample?
-Dave
This isn't working. The javaScript runs through just fine, but commit is not doing anything.
I am handeling both RowUpdating and RowUpdated server events and they are never hit. Nothing happens when I check the checkbox.
I have also turned off AutoCrud since I need to handle the update myself (doesn't work even when AutoCrud is on).
This could be done with some client code. What you would need to do is handle the valueChanging client event on the editing core. This should have a reference to the cell that is being updated. Then you can get the row. Based upon some condition on your row, you could call args.set_cancel(true) to prevent the checkbox from switching values, effectively making it readonly. There was a bug that was fixed regarding this event args. I'm not positive if it made it into the RTM or if it resolved in the first service release. If args.get_cell() returns null, you'll need to use args._cell until you upgrade to the Service Release.
thanks,Dave
Okay, so next question... Is it possible to enable/disable this checkbox on a row by row basis?
Hi RBonser,
This should be possible. There is no autopostback flag, but you can commit the value. What you should do is handle the ValueChanged client event off of the EditingCore behavior. In that, you could check for the correct column key and then call commit off of the editing core behavior.
var grid = $find("WebDataGrid1");
You may need to handle the RowUpdating or RowUpdated server event for EditingCore in order to make row updating not do its batch mode. I think commit is fixed so it should go back. Hopefully this is what you're looking for. Let me know if you have any other trouble with the new column or see room for improvement in it.
regards,David Young