Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Handling exceptions during AJAX callsHandling exceptions during AJAX calls
Previous
 
Next
New Post
8/20/2009 2:07 PM
 

Hello,

Basic requirement: In our project we want to show a friendly error message in a modal popup when some exception occures during AJAX calls.

I tried the example given @ http://www.asp.net/AJAX/documentation/live/Tutorials/CustomizingErrorHandlingforUpdatePanel.aspx

When I create a separate ASPX page and follow the steps mentioned in that tutorial, it works well.

But when I try to follow the same steps in a DNN module, it doesn't work. Ofcourse I'm NOT adding any ScriptManager explicitly in the module. Instead I'm using the ScriptManager returned by DotNetNuke.Framework.AJAX.ScriptManagerControl(Page). Using this script manager I'm registering my ScriptManager1_AsyncPostBackError() method for the AsyncPostBackError event. But this method never gets executed. This is because whenever any exception occurs PageBase.Page_Error() method gets executed first [we are using DNN 4.9.0], which redirects the user to error page. As this method is declared private I can't even override it in Default.aspx.vb.

If I override OnError() method in Default.aspx.vb then it stops redirecting to error page. But in this case it doesn't cause the AsyncPostBackError event and I don't get the expected behaviour. In this case I'm able to show a modal popup on client side, but the error message received is always:

Sys.Webforms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server.
The status code returned from the server was: 500

Instead what I want is to see the message that I set to ScriptManager1.AsyncPostBackErrorMessage inside ScriptManager1_AsyncPostBackError().

Is there any way to do it?

 

Thanks & Regards,
- Vivek Athalye

 

 
New Post
8/21/2009 7:42 AM
 

Hello,

Now I've removed the Page_Error event handler using RemoveHandler inside Page_Load method of Default.aspx.vb. This resolves my problem of Response.Redirect. I can see the actual exception message in modal popup. Or whatever string I set to ScriptManager.AsyncPostBackErrorMessage. But I've to set the message in Page_Load method of my module. The ScriptManager.AsyncPostBackError is not getting fired. I don't know why!!

Here is the Page_Load method of my module:

        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                AJAX.AddScriptManager(Page);
                using (ScriptManager manager = AJAX.ScriptManagerControl(Page) as ScriptManager)
                {
                    manager.AsyncPostBackErrorMessage = "ERRRRRRRRRR";
                    manager.AsyncPostBackError += this.ScriptManager1_AsyncPostBackError;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
 

 Can some one tell me what could be stopping AsyncPostBackError event from firing?

Now I'm trying to fire this event explicitly inside OnError() method of Default.aspx.vb, but I'm not able to do it. Can this be done?

        Protected Overrides Sub OnError(ByVal e As System.EventArgs)

            ' RaiseEvent AsyncPostBackError <<< how??
            MyBase.OnError(e)

        End Sub

 

Thanks & Regards,
- Vivek Athalye

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Handling exceptions during AJAX callsHandling exceptions during AJAX calls


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out