Sep 15, 2007 11:02 PM|jshepler|LINK
When dynamically adding controls that subscribe to events, the subscriptions are not "remembered" on postback - they are not saved as part of the viewstate. Therefore, you need to re-subscribe to the events when you re-create the controls (you also need
to re-create dynamically added controls for the same reason). You need to do this on or before the Page_Load event. In fact, asp.net 2.0 added the Page_PreLoad() event for such things.
Also, in case you hadn't noticed, the warning that the code is not reachable applies to the code after throwing the exception. Throwing exceptions ends the processing of the method so the code after it is, in effect, "not reachable". That exception is part
of the stub that VS builds - it needs to be removed when adding code to the method.