This is a migrated thread and some comments may be shown as answers.

Display confirm window when click on pagination button

2 Answers 16 Views
Grid
This is a migrated thread and some comments may be shown as answers.
suresh
Top achievements
Rank 1
suresh asked on 20 Aug 2014, 09:39 AM
Display confirm window when click on pagination button, means grid should display the pages according to confirm window result. for example we are in 1st page of grid if i click next button it has to show confirm window if press OK button it should move to next page otherwise it should stay on the current page only. 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 20 Aug 2014, 09:57 AM
Hi Suresh,

Please try the following code snippet to set confirm on grid paging.

ASPX:
<ClientSettings>
    <ClientEvents OnGridCreated="gridCreated" OnCommand="onCommand" />
</ClientSettings>

JS:
<script type="text/javascript">
    function onCommand(sender, args) {
    }
    function gridCreated(sender, args) {
        var pagerRow = sender.get_masterTableView().get_element().tFoot;
        var anchors = pagerRow.getElementsByTagName('a');
        for (var i = 0; i < anchors.length; i++) {
            if (anchors[i].className != "rgCurrentPage" && anchors[i].href.indexOf("javascript:__doPostBack") > -1) {
                var clickScript = anchors[i].attributes["onclick"].value;
                anchors[i].onclick = confirmPage;
            }
        }
 
        var submits = pagerRow.getElementsByTagName('input');
        for (var i = 0; i < submits.length; i++) {
            if (submits[i].type == "submit") {
                submits[i].onclick = confirmPage;
            }
        }
    }
 
    function confirmPage() {
        return confirm("Are you sure you want to page?");
    }
</script>

Thanks,
Princy
0
suresh
Top achievements
Rank 1
answered on 28 Aug 2014, 10:06 AM
Hi Princy,

      Thanks for your replay, but i am using Kendo Grid with HTML5 and JS. can you please solve my issue using these technologies.

Thanks
Suresh Rongali
Tags
Grid
Asked by
suresh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
suresh
Top achievements
Rank 1
Share this question
or