Hilton Giesenow's Jumbled Mind

Thursday, October 14, 2004

Dynamic Control Creation, Viewstate and Event Binding

Scott Mitchell of 4GuysFromRolla fame has been posting some interesting entries about dynamic control creation in ASP.NET and how viewstate won't get saved correctly depending on the order in which the control is added to the controlscollection of the parent. I recently found that event binding has a similar issue with a dynamic control.

To bind to an event for a dynamic control (i.e. one you create in code) with the AddHandler (VB.NET) keyword you need to have added the control to the parent's controlcollection property first. The same is obviously true for the viewstate of the control.

0 Comments:

Post a Comment

<< Home