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 8662341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:42:57+00:00 2026-06-12T16:42:57+00:00

Scenario: I have onbeforeunload function on .aspx page which I am using to display

  • 0

Scenario: I have onbeforeunload function on .aspx page which I am using to display a message before navigating away from current page (ASP.NET Application). This page is quite complex where post backs are happening at quite a few times e.g. I have multiple buttons, Rad Grid, Rad Window PopUps etc.

So, all the buttons call onbeforeunload whenever they are clicked and message box is being called un-necessarily. To prevent onbeforeunload message displaying I am just calling another cancelEvent function on button’s OnClientClick event where I am just calling null. By doing this all the button post backs are handled but the RadGrid which I am using has Button Columns (Delete) and whenever a row is deleted from the grid it offcourse refreshes the grid which ultimately calls onbeforeunload.

Could please anyone tell me how I can prevent onbeforeunload when I delete anything from RadGrid. Following is the code snippet that I am using and working fine for buttons but I need help for grid delete column may be some event like Button’s OnClientClick event that I can use to call my cancelEvent.

window.onbeforeunload = confirmExit;
function confirmExit() {
            window.event.returnValue = 'If you navigate away from this page any unsaved changes will be lost!';
}

function cancelEvent(event) {
            window[event] = function () {null}
}

<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" CssClass="ActionButtons"
            ValidationGroup="vsDataEntry" OnClientClick="return cancelEvent('onbeforeunload')"/>
  • 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-12T16:42:58+00:00Added an answer on June 12, 2026 at 4:42 pm

    Try doing something like the below

    <div onclick="return cancelEvent('onbeforeunload')">
        <telerik:RadGrid runat="server">
        </telerik:RadGrid>
    </div>
    

    Explanation

    When the click event is triggered it is bubbled through all the element in DOM. We are wrapping the Radgrid inside a div and whenever any click happens inside that div we are removing the onbeforeunload.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an 'ask_a_question' page with an onbeforeunload function to alert the user before
Scenario: I have a page which contains a dropdownlist and a table which contains
Scenario: I have a php page in which I call a python script. Python
Scenario I have an application using asp.net Master Pages in which I would like
Scenario: We have a scheduler which is using JDBC Job Store. Quartz version is
Scenario: We have MVC 4.0 web application with display myOrders which returns json result
Scenario I have recently graduated from university with a degree in Computer Science. My
Scenario I have a DevExpress DataGrid which is bound to a DataSet in C#.
Scenario :- I have to call MYSQL stored procedure from PHP and do some
Scenario: I have a document I created using LaTeX (my resume in this case),

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.