Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   retrieve dynmatic control values (http://www.velocityreviews.com/forums/t66007-retrieve-dynmatic-control-values.html)

nic 11-05-2003 09:11 PM

retrieve dynmatic control values
 
Hi,
I have an aspx page where I dynamically generate a number
of input controls. Upon submitting the form I need to re-
create the controls in order to retrieve their values. I
understand this, but I'm confused on how the newly
generated control and the previous control (before
postback) can share the same value (I'm glad it works but
I don't see how).

I also noticed I need to re-create the control in the
Page_Load event. If I create it in a later event (i.e. in
some method called by an onClick event) the form values
can not be retrieved.

When is the best time to recreate the control and how does
it work?

Thanks

Giorgio Parmeggiani 11-05-2003 10:30 PM

Re: retrieve dynmatic control values
 
Hi

> I have an aspx page where I dynamically generate a number
> of input controls. Upon submitting the form I need to re-
> create the controls in order to retrieve their values. I
> understand this, but I'm confused on how the newly
> generated control and the previous control (before
> postback) can share the same value (I'm glad it works but
> I don't see how).


The viewstate allows you to reload the values, however
, to every postback, you must always have recreated the same controls with
the same characteristics!

> I also noticed I need to re-create the control in the
> Page_Load event. If I create it in a later event (i.e. in
> some method called by an onClick event) the form values
> can not be retrieved.
>
> When is the best time to recreate the control and how does
> it work?


The best time to recreate the control is in the "Init" Event so the
ViewState is correctly loaded.

Ciao
Giorgio




All times are GMT. The time now is 04:02 AM.

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