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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:30:57+00:00 2026-05-12T11:30:57+00:00

In Visual Studio 2008 if you create a new Ajax 1.0 Enabled ASP.NET 2.0

  • 0

In Visual Studio 2008 if you create a new “Ajax 1.0 Enabled ASP.NET 2.0 Web Application” and paste the following code:

<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Button runat="server" ID="foo" Text="click me" onclick="foo_Click" />      
            </ContentTemplate>
        </asp:UpdatePanel>
        </div>
    </form>

code behind

protected void foo_Click(object sender, EventArgs e) {
            throw new Exception("hello");
        }

and then click the button, you’ll see a javascript alert that says “hello”. If you create a .NET 3.5 Web Application and paste the same code in, no alert shows up anymore. What am I missing?

  • 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-12T11:30:57+00:00Added an answer on May 12, 2026 at 11:30 am

    There was definately a change between the default behavior in the ASP.NET AJAX Extensions 1.0 and ASP.NET AJAX 3.5. This can been seen by looking at the default endPostBack event handlers for the Sys.WebForms.PageRequestManager. The former version displays the error using an Alert while the later just rethrows the error.

    // ASP.NET AJAX Extensions 1.0
    function Sys$WebForms$PageRequestManager$_endPostBack(error, response) {
      this._processingRequest = false;
    
      this._request = null;
      this._additionalInput = null;
    
      var handler = this._get_eventHandlerList().getHandler("endRequest");
      var errorHandled = false;
      if (handler) {
        var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, this._dataItems, response);
        handler(this, eventArgs);
        errorHandled = eventArgs.get_errorHandled();
      }
      this._dataItems = null;
      if (error && !errorHandled) {
        alert(error.message);
      }
    }
    
    
    // ASP.NET 3.5
    function Sys$WebForms$PageRequestManager$_endPostBack(error, executor, data) {
      if (this._request === executor.get_webRequest()) {
        this._processingRequest = false;
        this._additionalInput = null;
        this._request = null;
      }
      var handler = this._get_eventHandlerList().getHandler("endRequest");
      var errorHandled = false;
      if (handler) {
        var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
        handler(this, eventArgs);
        errorHandled = eventArgs.get_errorHandled();
      }
      if (error && !errorHandled) {
        throw error;
      }
    }
    

    If you want the Alert to appear in your ASP.NET AJAX 3.5 code, you just need to make some small changes.

    First, you need to add an handler for the ScriptManager’s AsyncPostBackError event and then set the AsyncPostBackErrorMessage.

    protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
    {
        ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message;
    }
    

    Then you need to add a handler for the client-side PageRequestManager’s endRequest event. In there, you can get the AsyncPostBackErrorMessage set on the server-side and use an Alert to display the message to the user.

    function pageLoad()
    {
      Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onEndRequest);  
    }
    
    function onEndRequest(sender, args)
    {
      var msg = args.get_error().message;
      alert(msg);
      args.set_errorHandled(true);
    }
    

    I hope this helps.

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

Sidebar

Ask A Question

Stats

  • Questions 263k
  • Answers 263k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer OK, I've come up with one solution but I'm not… May 13, 2026 at 12:05 pm
  • Editorial Team
    Editorial Team added an answer your column DATE_PROC is a DATE, you should always compare… May 13, 2026 at 12:05 pm
  • Editorial Team
    Editorial Team added an answer Depending on what you're looking at doing with the Social… May 13, 2026 at 12:05 pm

Related Questions

Can anyone explain to me how to create a uninstall command for a Windows-based
For some reason when I create a new namespace in Visual Studio 2008 its
All of these bits of text look the same, but I am trying to
Im using Visual Studio 2008, on an ASP.NET C# website. Overall what I want

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.