I have been banging my head on this for a couple days. I have a simple radgrid in which I am doing batch editing. The problem I have is that when I change the page or sort a column any changes made are lost. I want the changes to automatically be saved via the BatchEditCommand server-side event before the page flip or sort occurs. I have subscribed to the RadGrid's OnCommand client side event and the function is below.
The javascript function is being executed properly when I page or sort and everything seems fine at each point when debugging. The server side function--BatchEditcommand--functions properly, but it is simply not being executed from this point.
I know the grid.get_batchEditingManager().saveChanges(grid.get_masterTableView()); is being executed because this function runs again immediately and the args.get_commandName() returns "BatchEdit" as it should.
The only way I can get the BatchEditCommand server side event to fire is if i put a args.set_cancel(true); after the grid.saveChanges in the javascript, but then that cancels the paging or sorting action which I want to still happen after saving the changed data. I feel like this should work since the paging action and the saving action both cause postback anyway.
Any ideas?
Thanks.
function UserAction(sender, args) { var grid = $find("<%= grdWaterUses.ClientID %>"); if (args.get_commandName() == "Sort" || args.get_commandName() == "Page") { if (grid.get_batchEditingManager().hasChanges(grid.get_masterTableView())) { document.getElementById("<%= hiddenPostbackCommand.ClientID %>").value = "ClientSave"; grid.get_batchEditingManager().saveChanges(grid.get_masterTableView()); } } }