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

Discussion in 'ASP .Net' started by Guest, Jan 31, 2005.

  1. Guest

    Guest 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.
     
    Guest, Jan 31, 2005
    #1
    1. Advertising

  2. Guest

    Karl Seguin Guest

    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

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    <> wrote in message
    news:...
    > 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.
    >
    >
     
    Karl Seguin, Jan 31, 2005
    #2
    1. Advertising

  3. Guest

    Guest

    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


    Karl Seguin wrote:
    > 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
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > <> wrote in message
    > news:...
    > > 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.
    > >
    > >
     
    , Jan 31, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doug
    Replies:
    3
    Views:
    3,071
  2. pythos

    Help with trapping an exception

    pythos, Aug 24, 2004, in forum: Python
    Replies:
    3
    Views:
    348
    pythos
    Aug 24, 2004
  3. KKramsch

    Exception trapping in C?

    KKramsch, Dec 3, 2004, in forum: C Programming
    Replies:
    19
    Views:
    615
    Dave Vandervies
    Dec 7, 2004
  4. pabbu
    Replies:
    8
    Views:
    745
    Marc Boyer
    Nov 7, 2005
  5. Daniel Nogradi

    Re: Re-ocurring Events

    Daniel Nogradi, Apr 26, 2007, in forum: Python
    Replies:
    5
    Views:
    302
    Robert Rawlins - Think Blue
    Apr 27, 2007
Loading...

Share This Page