Load user control to display server error

4 posts, 0 answers
  1. rafalr
    rafalr avatar
    5 posts
    Member since:
    Apr 2012

    Posted 26 Jul 2013 Link to this post

    Hi all,

    I have this scenario:
    - MasterPage with left side menu,
    - center  RadAjaxPanel,
    changing selection on left menu tree change content of the center page.
    Also controls are loaded dynamically. I want handle errors accoured on server by displaying usercontrol. .
    I try'd use  RadScriptManager.AsyncPostBackError and here load my usercontrol with error information, but no luck, Js exception is thrown

    PageRequestManagerServerErrorException

    with error from server. 

    EnableEventValidation is set to "false" on the my MainPage.aspx

    Thanks in advance rafalr
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 31 Jul 2013 Link to this post

    Hi Rafal,

    The provided information and the error description are rather generic so it  is heard to determine what exactly is causing the issue. Could you please share your application markup as well as the related code behind so that we could further assist?

    Regards,
    Maria Ilieva
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. rafalr
    rafalr avatar
    5 posts
    Member since:
    Apr 2012

    Posted 31 Jul 2013 Link to this post

    Hi Maria,

    I need solution to display server error, i have partial page rendering, also i try to bind RadScriptManager to AsyncPostBackError event.
    Everything work fine, i can display error message on client side using alert or div.
    Is it possible to load custom usercontrol with error description on    AsyncPostBackError event ?
     
    protected virtual void ScriptManagerAsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
            {
                
               LoadUserControl(pathtoErrorControl);
               Server.ClearError(); // to not call global.asax application error
            }
    private void LoadUserControl(string ucCtrlPath )
            {
                ctrl = LoadControl(ucCtrlPath);
                RightPane.Controls.Clear();
                if (ctrl != null)
                {
                    string userControlID = ucCtrlPath.Split('.')[0].Replace("/", "").Replace("~", "");
                    ctrl.ID = userControlID;
                    if (ctrl != null && RightPane.Controls.Count == 0)
                    {
                        RightPane.Controls.Add(ctrl);
                    }
                }
            }
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 02 Aug 2013 Link to this post

    Hi Rafal,

    You could review the online article below which elaborates on creating and throwing server exceptions:
    http://msdn.microsoft.com/en-us/library/ms173163.aspx

    Regards,
    Maria Ilieva
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top