AUTHOR: Marin Bratanov
DATE POSTED: May 31, 2018
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.
<script>
var
currPageWhenDeleting;
function
OnRowDeleted(sender, args) {
currPageWhenDeleting = sender.get_masterTableView().get_currentPageIndex();
}
OnCommand(sender, args) {
if
(currPageWhenDeleting && args.get_commandName() ==
"Page"
) {
args.set_cancel(
true
);
restorePage = currPageWhenDeleting;
currPageWhenDeleting =
null
;
//clear the original flag to avoid an endless loop
setTimeout(
() {
sender.get_masterTableView().page(restorePage + 1);
//restore the previous page
}, 100);
</script>
<telerik:RadGrid RenderMode=
"Lightweight"
ID=
"RadGrid1"
runat=
"server"
>
<MasterTableView EditMode=
"Batch"
<ClientSettings>
<ClientEvents OnCommand=
"OnCommand"
OnRowDeleted=
"OnRowDeleted"
/>
</ClientSettings>
</telerik:RadGrid>
ClientDataSource binding: after filtering so no records are present and removing the filter there is no pager
Resources Buy Try