New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

RadGrid ClientDataSource binding and batch editing: page is reset to 1 after deleting a record


Client side bound Radgrid with batch editing: if you page the grid and do a client side delete. then save the changes, the active page in the pager goes to number 1 page.


You can store the current page index when a row is deleted and in the next page command, .page() the grid to the previous page.

        var currPageWhenDeleting;

        function OnRowDeleted(sender, args) {
            currPageWhenDeleting = sender.get_masterTableView().get_currentPageIndex();

        function OnCommand(sender, args) {
            if (currPageWhenDeleting && args.get_commandName() == "Page") {
                var restorePage = currPageWhenDeleting;
                currPageWhenDeleting = null; //clear the original flag to avoid an endless loop
                setTimeout(function () {
                    sender.get_masterTableView().page(restorePage + 1); //restore the previous page
                }, 100);
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server">
   <MasterTableView EditMode="Batch">
        <ClientEvents OnCommand="OnCommand" OnRowDeleted="OnRowDeleted" />

See Also

In this article