Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9140423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:30:52+00:00 2026-06-17T09:30:52+00:00

I currently have a js function that binds onchange to onbeforeunload or a confirmbox

  • 0

I currently have a js function that binds onchange to onbeforeunload or a confirmbox only if there are changes on the grid.

I am trying to select the footer paging anchors so that it doesn’t trigger for confirm or onbeforeunload. The user should select the numeric paging regardless if there are changes or not on the grid.

There is no ID or class name on the anchors so I’m having trouble accessing it.

Thanks in advance.

RadGrid properties:

             <telerik:RadGrid 
             runat="server" 
             ID="DataGridFooItems" 
             AllowSorting="true" 
             AutoGenerateColumns="false" 
             EnableViewState="True" 
             GridLines="Vertical" 
             AllowPaging="True" 
             PagerStyle-Mode="NumericPages">

             <MasterTableView 
             AllowPaging="true" 
             DataKeyNames="foopersonID,fooItemID" 
             AllowAutomaticDeletes="true" 
             CommandItemDisplay="None" 
             NoMasterRecordsText="" >

This is what the .aspx generates below:

    <TFOOT>
<TR class=rgPager>
<TD colSpan=20>
<TABLE style="WIDTH: 100%" border=0 cellSpacing=0>
<TBODY>
<TR>
<TD class="rgPagerCell NumericPages">
<DIV class="rgWrap rgNumPart">
<A class=rgCurrentPage onclick="returnfalse;"href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl02','')"><SPAN>1</SPAN></A><A 
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl04','')"><SPAN>2</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl06','')"><SPAN>3</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl08','')"><SPAN>4</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl10','')"><SPAN>5</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl12','')"><SPAN>6</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl14','')"><SPAN>7</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl16','')"><SPAN>8</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl18','')"><SPAN>9</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl20','')"><SPAN>10</SPAN></A><A
href="javascript:__doPostBack('ctl00$ph$FOO$rgItems$ctl00$ctl03$ctl01$ctl22','')"><SPAN>...</SPAN></A> 
</DIV></TD></TR></TBODY></TABLE></TD></TR></TFOOT>

UPDATE: Answer!

Found it! with some research and tweaking of a similar Telerik Solution.

I composed this:

  1. I declared a variable which selected a class.
  2. Then I searched through the object for all the anchors.
  3. Afterwards, I used a loop through anchors if it is not on the
    current page(should not have a click event, since the user is
    already on the page.) && if the anchor has a href of __doPostback.
  4. Then i set the attribute onclick event to a confirmation. This step
    wrapped the __doPostback.

Source: http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-paging—pageindexchanged-event-issue.aspx

function preventPromptOnFooter() {

            var pagerCell = $('[class="rgPagerCell NumericPages"]')
            var anchors = $(pagerCell).find('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 = disableOnbeforeUnloadForFooter;
                }
            }



            function disableOnbeforeUnloadForFooter() {
                window.onbeforeunload = null;
            }
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:30:53+00:00Added an answer on June 17, 2026 at 9:30 am

    Found it! with some research and tweaking of a similar Telerik Solution.

    I composed this:

    1. I declared a variable which selected a class.
    2. Then I searched
      through the object for all the anchors. anchors
    3. Afterwards, I used a loop
      through anchors if it is not on the current page(should not have a
      click event, since the user is already on the page.) && if the
      anchor has a href of __doPostback.

      1. If step (3.) is true, it set the attribute onclick event to a confirmation. This step wrapped the __doPostback.

    Source:
    http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-paging—pageindexchanged-event-issue.aspx

    function preventPromptOnFooter() {
    
                var pagerCell = $('[class="rgPagerCell NumericPages"]')
                var anchors = $(pagerCell).find('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 = disableOnbeforeUnloadForFooter;
                    }
                }
    
    
    
                function disableOnbeforeUnloadForFooter() {
                    window.onbeforeunload = null;
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a function that will create X tasks of a function based
I currently have a function that grabs the browser windows uri, parses out the
I currently have a Javascript function that uses a string to reference an object
I currently have a function written called saveWorkout that saves an NSMutableArray to another
I currently have a jQuery function that disables a Checkboxlist if the Parent Checkbox
I have a jQuery function that binds the click event of any element on
currently we are using asynchronous values very heavily. Assume that I have a function
I have a Web Application that currently uses JQGrid but I'm trying to introduce
So I have function that formats a date to coerce to given enum DateType{CURRENT,
I have a function that get the current weeknumber from the given date e.g.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.