Home > C#, javascript, SharePoint > Troubleshooting with Asynchronous post back errors or Error occurred in Ajax control toolkit.

Troubleshooting with Asynchronous post back errors or Error occurred in Ajax control toolkit.

Its often hard to identify the error occurred in scripts , specially with asynchronous post backs and Ajax update panel.

A good and affective way to identify is described by Mr. Aqeel (An experienced SharePoint developer) to me and i am very glad write it here.

ScriptManager.GetCurrent(this.Page).AsyncPostBackError += new EventHandler<AsyncPostBackErrorEventArgs>(UC_AsyncPostBackError);

I have user control which populates the data and some scripts are being attached to it.

so declared the event  AsyncPostBackError in page load of that user control.

Then into the even of AsyncPostBackError.

void UC_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
      {
          try
          {
              string exc = e.Exception.Message;
          }
          catch (Exception ex)
          {

              throw;
          }
      }

This would let you know the exact exception occurred.

Advertisements
  1. Shafaqat Ali
    February 7, 2012 at 5:45 pm

    good post

  2. February 8, 2012 at 11:13 am

    Thanks

  3. Hugo Dias
    October 30, 2012 at 11:18 pm

    Hi, this will show the error on a server error page, isn’t it?
    If I want to show it in a popup message, how can I do it?
    Thanks

  4. zeeshan
    December 21, 2016 at 10:28 am

    Response.write(“alert(“+ex.message+”)”);

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: