You can have an error handler at the Page level (Page_Error) which catches
the error and does some processing, but it might have other effects
(unwanted ones) on your app. But try it out.
Personally if it is known that error is raised I would either:
-Try to handle it in the UC itself (own error handler there) and not let
Page do anything with it
or
-if Page needs know about it but doesn't need to do more, indeed raise an
event from the UC
And please note that raising exceptions shouldn't be normal logic, but they
would really need to be used in exceptional situations. Maybe you could
redesign it so that Page invokes the action in UC by calling UC's method,
when it could also handle possible exceptions or return data coming from the
method call (which would indicate error case)
But all these depends on what you need to do withing the Page 8there could
be other alternatives as well). Write the error data for user or something?
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
"Prince Mathew" <pr****************@hotmail.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
Hi All,
I have a requirement. I am throwing an exception from the Page_Load of my
user control I want
to catch this in my container page. Is this possible?
The Page_Load of user control is executed after the Page_Load of the page.
So we cannot catch this in the Page_Load of the page. So my question where
in the page i will catch the exception thrown form the user control.
I don't want any event to be raised from the user control.
PLEASE HELP ME.
Thanks
Prince