Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Adding a Dynamic User Control from the Base Page Class (and retaining it on Postback?) (http://www.velocityreviews.com/forums/t775602-adding-a-dynamic-user-control-from-the-base-page-class-and-retaining-it-on-postback.html)

David Bowey 03-10-2005 06:27 AM

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



recoil@community.nospam 03-10-2005 02:24 PM

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


Nick Stansbury 04-05-2005 08:17 AM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57