Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
Exception Handling Within WARP Panel
posted

Has anyone at Infragistics considered improving the mechanism through which the WARP Panel handles errors?  I had an issue with two controls having the same ID after Page_Init in a WARP Panel; the panel would encounter an exception and the entire page would refresh without providing any clues about the nature or cause of the exception.  If it's not possible to improve the exception handler on the Panel, perhaps some developer guidelines or recommendations for identifying errors would be helpful.

Parents
No Data
Reply
  • 24497
    posted

    Hi,

    To process error on client you may use ClientSideEvents.Error. Below is example:

    <script type="text/javascript">
    function
    WebAsyncRefreshPanel1_Error(oPanel,oEvent,flags)
    {
     
    var serverError = ig_shared.getCBManager().serverError;
      alert(
    'flag:' + flags + '\nserverError:' + serverError);
    }
    </script>

    <igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server" ClientError="WebAsyncRefreshPanel1_Error">
      <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
    </
    igmisc:WebAsyncRefreshPanel>

    To process error on server (global error) you may use AddErrorHandler. Below is example:

    protected void Page_Load(object sender, EventArgs e)
    {
       Infragistics.WebUI.Shared.
    CallBackManager.AddErrorHandler(this, this.OnWarpError);
    }

    void OnWarpError(object sender, UnhandledExceptionEventArgs e)
    {
     
    object ex = e.ExceptionObject;
     
    if(e.IsTerminating)
         ex =
    "Error will trigger full post back on client.";
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
      
    //throw new Exception("Click exception");
    }

Children