title: Show error caused during patrial postback
body: <p><strong>Is there a way to show error notification to user when error occurred during partial postback of an Update Panel?</strong></p>
  
  <p>I have tried injecting script using <code>RegisterStartupScript</code> and <code>RegisterClientScriptBlock</code> both, but failed, I believe because partial postback is not successful therefore update panel's internal framework stop executing script, which causes my error notification script to not run. Below is the error I generated on click of a Test button, on click of which
  <a href="https://i.stack.imgur.com/Wnghk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wnghk.png" alt="enter image description here"></a></p>
  
  <p>Below is the code I'm using to inject error notification alert box for all errors caused during partial postback.</p>
  
  <pre><code>protected void Application_Error(object sender, EventArgs e)  {
      Entities.Exception exceptionObj = new Entities.Exception();
      Exception x = Server.GetLastError();
  
      if (x != null)  {
          if (x.InnerException != null)  {
              exceptionObj.Message = x.InnerException.Message.ToString();
              exceptionObj.StackTrace = x.InnerException.ToString();
          }  else  {
              exceptionObj.Message = x.Message.ToString();
              exceptionObj.StackTrace = x.ToString();
          }
      }
  
      Server.ClearError();
  
      System.Web.UI.Page page = System.Web.HttpContext.Current.Handler as System.Web.UI.Page;
      if (page != null)  {
          RadAjaxManager MainRadAjaxManager = RadAjaxManager.GetCurrent(page);
  
          if (MainRadAjaxManager != null &amp;&amp; MainRadAjaxManager.IsAjaxRequest)
              // didn't work
              //MainRadAjaxManager.ResponseScripts.Add(script); 
  
              // didn't work
              //page.ClientScript.RegisterStartupScript(page.GetType(), Guid.NewGuid().ToString(), "alert('Yogesh');", true);
  
              // didn't work
              page.ClientScript.RegisterClientScriptBlock(page.GetType(), Guid.NewGuid().ToString(), "alert('Error Occured.');", true);
      }
  }
  </code></pre>
  
  <p><em>Note: I'm using Telerik's RadAjaxManager</em></p>