This is a migrated thread and some comments may be shown as answers.

Load user control to display server error

3 Answers 61 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
rafalr
Top achievements
Rank 1
rafalr asked on 26 Jul 2013, 01:08 PM
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

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 31 Jul 2013, 10:51 AM
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.
0
rafalr
Top achievements
Rank 1
answered on 31 Jul 2013, 11:04 AM
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);
                }
            }
        }
0
Maria Ilieva
Telerik team
answered on 02 Aug 2013, 11:08 AM
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.
Tags
Ajax
Asked by
rafalr
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
rafalr
Top achievements
Rank 1
Share this question
or