Sorry. Prince, you are correct. Page_load event would not be able to catch the exception. I experienced the problem and handled the exception within the UserControl itself. Have you tried to catch the exception in -OnInit method? This is first in the line of Control Execution Lifecycle. I did not try but you may want to give it a try.
However, if you dynamically load the control (why not) you would have much better control over the exception handling. In this case, there would not be any need to register a tagprefix, etc.
Thanks,
Prodip
www.aspnet4you.com
"Prince Mathew" <> wrote in message news:...
Prodip,
Have you tried what you have said ????. Page_Load of the user control is executed after the Page_Load of the Page.
Thanks
Prince
"Prodip Saha" <> wrote in message news:...
If you don't want to bubble up an event in the UserControl, your best option is to catch the error in Page_Load event. Alternatively, you can load the control at runtime(dynamically) and catch the exception in that method.
Thanks,
Prodip
www.aspnet4you.com
"Prince Mathew" <> wrote in message news:...
> Kevin,
>
> I know how exception handling works. But my question is how will you catch
> an exception thrown from the User Control. Say you are throwing an exception
> from the Page_Load of the user control.Where will you put the try catch in
> the container page.
>
> Thanks
> Prince
>
> "Kevin Spencer" <> wrote in message
> news:...
> > Here's how exceptions work. When a function calls another function that
> > calls another function that raises an exception, the final function raises
> > the exception. If the exception is not handled by that function, it will
> > cause the exception to "bubble up" to the function that called the
> > function that raised the exception. This will happen until either (1) the
> > exception is handled at some point in the chain, or (2) the application
> > thread is aborted due to an unhandled exception.
> >
> > Knowing this, of course, your solution is obvious.
> >
> > --
> > HTH,
> >
> > Kevin Spencer
> > Microsoft MVP
> > .Net Developer
> > What You Seek Is What You Get.
> >
> > "Prince Mathew" <> wrote in message
> > news:...
> >> Hi All,
> >>
> >>
> >>
> >> I have a requirement. I am throwing an exception from my user control I
> >> want to catch this in my container page. Is this possible?
> >>
> >> I don't want any event to be raised.
> >>
> >> PLEASE HELP ME.
> >>
> >>
> >>
> >> Thanks
> >>
> >> Prince
> >>
> >>
> >
> >
>
>