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

  • SEARCH
  • Home
  • 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 3285760
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:18:10+00:00 2026-05-17T20:18:10+00:00

Within an ASP.NET AJAX UpdatePanel on my page I have a submit button which

  • 0

Within an ASP.NET AJAX UpdatePanel on my page I have a submit button which has some custom javascript validation applied which set a global _cancelGeneralSettingsUpdate flag depending on the results of the validation.

Everything works unless you enter an invalid value, correct it, and resubmit. In this case the variable _cancelGeneralSettingsUpdate is correctly set to false but the initializeRequest function is not called before the page attempts to postback via AJAX, causing the postback to fail.

I need to be able to have postbacks succeed once the invalid input has been corrected and the user clicks the submit button again. Unfortunately I do not seem to be properly wired into the PageRequestManager pipeline once postback has been cancelled. If I refresh the page, everything works again, but cancelling the postback via args.set_cancel(true);
puts me into a state in which I cannot make further postbacks via AJAX until the page is refreshed.

How can I re-enable postbacks or cause the initializeRequest to fire and set this before subsequent postbacks?

I have attached some of my code. Assume _cancelGeneralSettingsUpdate is set correctly before any attempt to postback, as I have verified this.

var _cancelGeneralSettingsUpdate = false;

function initializeRequest(sender, args) {
        var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
        if (!pageRequestManager.get_isInAsyncPostBack() & args.get_postBackElement().id == '<%= UpdateWorkgroupGeneralButton.ClientID %>')
        {
            if (_cancelGeneralSettingsUpdate) {
                args.set_cancel(true);
                // Show error message
            }
            else {
                args.set_cancel(false);
            }
        }
        else {
            args.set_cancel(false);
        }
    }
  • 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-05-17T20:18:11+00:00Added an answer on May 17, 2026 at 8:18 pm

    Thought I found the solution. The proper thing to do in my case is to call this function when my JavaScript validation fails

     Sys.WebForms.PageRequestManager.getInstance().abortPostBack();
    

    In my example above, I was calling args.set_cancel(false); in a custom initializeRequest handler. While this worked for the first instance, it did not allow future postbacks to succeed after the user corrected their invalid input and attempted to resubmit the form.

    This actually will only abort postbacks which are currently in-flight. In my case __doPostBack(...) had not yet been called, so Sys.WebForms.PageRequestManager.getInstance().abortPostBack(); silently failed to do what I was expecting.

    End result was to use a two button system. Without bugfixing the AJAX library, this was the only reasonable option left.

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

Sidebar

Related Questions

I have an asp.net page within which I've used several AJAX controls doing partial
I have an asp.net page with a save button within an updatepanel and contenttemplate.
I'm using the ASP net Ajax toolkit and have a GridView within the UpdatePanel
Within an asp.net MVC app, I'm trying to find rooms which have a guest/client,
I have used JQuery within my asp.net page. JQuery is working fine. I could
I have a form within an ASP.NET MVC application and I'm trying to submit
Within an asp.net webform I have some jquery that controls the positioning of elements
I have an ajax controltoolkit reorderlist within an asp.net application. I need to disable
I have an ASP.Net 3.5 application in which I would like to setup some
We have an ASP.NET web application which uses ASP.NET Ajax. We open it from

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.