Trapping an Exception ocurring in a Webcontrol at the Page or parent WebControl level.

G

Guest

I am looking for a easy way to trap an Exception that may occurr in any one
of 30 child web controls to be trapped at the topmost parent WebUser control
or Page Level. I have tried variations of setting the Error event handler
for the topmost parent WebUser control that I want to handle the error to no
avail.

Sample code from the MSDN seems to imply that this can be done but it can
only be taken care of at the same user control level as I adapted their code
sample to my purpose and the exception was not caught by the event.
 
K

Karl Seguin

Have you simply tried hooking into the OnError event of the Page?

Simply put:
Protected Overrides Sub OnError(ByVal e As System.EventArgs)
'exception handling logic here
End Sub

in your page and you should be good to go.

Karl
 
M

marc.derider

That was the MSDN Sample I was talking about in my original message.
Yes it was tried. No it does not work.
Web Page
User Control - Main (wants to catch exception)
Child User Control
Child User control (throws exception - must be able to be
nested n-deep) .
OnError only traps an exception thrown in the current Control. It does
not capture the an exception thrown in child controls
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top