I have read and used info from this thread and all works just fine.
However I now need to trap, at client side, if the user clicks the "Add new row" link on the grid. To do this I added
to my grid and then added some javascript to process the event:
The javascript traps the event but the result is that the ItemCommand event at the server does not fire and the new default values for the check boxes are not set resulting in an error "Conversion from type DBNull to type Boolean is not valid".
If I remove the javascript I can add new rows without error and the ItemCommand event fires setting the default checkbox values.
However I now need to trap, at client side, if the user clicks the "Add new row" link on the grid. To do this I added
<ClientSettings> |
<ClientEvents OnCommand="RaiseCommand" /> |
</ClientSettings> |
to my grid and then added some javascript to process the event:
function RaiseCommand(sender, args) { |
var cmd = args.get_commandName(); |
if (cmd = 'InitInsert') { |
var message = "Add new clicked.\n" + |
"Click OK to continue or Cancel to change your selection.\n"; |
if (!confirm(message)) |
return args.set_cancel(true) |
else |
return args.set_cancel(false); |
} |
} |
The javascript traps the event but the result is that the ItemCommand event at the server does not fire and the new default values for the check boxes are not set resulting in an error "Conversion from type DBNull to type Boolean is not valid".
If I remove the javascript I can add new rows without error and the ItemCommand event fires setting the default checkbox values.