![]() |
Adding a Dynamic User Control from the Base Page Class (and retaining it on Postback?)
Hi There!
As the subject says, I need to add a user control dynamically (using LoadControl function) to the derieved page from the base Page class and I want the added contol to be retained on PostBack as well as retain its' state (such as properties). How do I acoomplish this? Thank you all in advance. Dave |
Re: Adding a Dynamic User Control from the Base Page Class (and retaining it on Postback?)
If possible create the control in the OnInit each time. Make sure you
give it a Unique ID. If you do both of these I believe the ViewState should be handled for you automatically |
Re: Adding a Dynamic User Control from the Base Page Class (and retaining it on Postback?)
I think it is also pretty important that you add the control in to the
controls collection before ammending any of its properties: i.e. dim txtAAA as textbox txtAAA = new textbox txtAAA.id = "txtAAA" txtAAA.text = "BBB" '<-- I don't think that this text property would be tracked by the viewstate me.controls.add(txtAAA) txtAAA.text = "AAA" <-- whereas this one would.... "David Bowey" <db@f.coz> wrote in message news:%23PK7EpTJFHA.3428@tk2msftngp13.phx.gbl... > Hi There! > > As the subject says, I need to add a user control dynamically (using > LoadControl function) to the derieved page from the base Page class and I > want the added contol to be retained on PostBack as well as retain its' > state (such as properties). > > How do I acoomplish this? > > Thank you all in advance. > Dave > > |
| All times are GMT. The time now is 01:17 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.