Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Error handling in Web Controls..


Message #1 by "v" <j_v@l...> on Mon, 2 Dec 2002 21:03:17
Hi,

    I am trying to implement a error handling solution for my application.
I have a main page which does a server.transfer to another page. This page 
includes multiple web controls and some of them loads a user control. 

    Main.aspx does some initialization and transfers to FirstPage.aspx 
which in turn includes server control (web:include) which basically loads 
a user control Test.ascx. ( I am trying to mimic Jsp:include syntax for 
including user controls).

    Whenever, I encounter an error in the ASCX, I would like to remove the 
Test.ascx and load the Error.ascx at the corresponding position. so that 
the rest of the page is not disturbed.

    When I try to remove the control from the Parent control, I get the 
following runtime-error. System.Web.HttpException - A control cannot 
modify its parents' control collections.

   I tried raising an event for the parent control, but still I got the 
same error.

   The only thing that seems to work for unhandled exception, is to be 
handled at the Main.aspx's Page_Error or on the Application_Error.
   
   Is there a work around to handle this situation? 


Thanks,
V

  Return to Index