I have a dynamically built grid with in-place editing and insert row. The insert row is always available at top and I have the following code to do so.
if
(!grid.MasterTableView.IsItemInserted)
{
grid.MasterTableView.IsItemInserted =
true;
grid.Rebind();
}
I have hooked up the OnCommand client event for a confirmation from user when they hit cancel on the row.
grid.ClientSettings.ClientEvents.OnCommand = "RaiseCommand";
<script type="text/javascript">
function RaiseCommand(sender, args) {
if ( (args.get_commandName() == "CancelUpdate") || (args.get_commandName() == "CancelInsert")) {
if (confirm('Are you sure you want to clear all of the answers for this row?')) {
args.set_cancel(
false);
}
else {
args.set_cancel(
true);
}
}
}
</script>
The problem is if the user confirms the cancel, the CancelCommand never gets fired for the Insert Row. It fires correctly for the Edit Row. I want to trap the CanceCommand to clear the insert row from any contents. Please help