Referencing value of a dynamically created control

Referencing value of a dynamically created control

Post by TWlrZ » Thu, 15 Jul 2004 06:01:03


I have a placeholder object in which I am dynamically placing controls based on a database query. Of course during postback these controls go away. I have seen other questions posed where someone wants the dynamically created controls to appear on the page. However in my case I don't really need to have the control displayed after postback, but I do need its value. When I look at the trace output from the page after postback, it lists the value of my dynamically created controls, but I cannot figure how to reference those values. Does anyone have any ideas?
 
 
 

Referencing value of a dynamically created control

Post by Davide Ver » Thu, 15 Jul 2004 06:12:18

Mike < XXXX@XXXXX.COM > typed:

Mike I think the problem is always the same: you create the controls
everytime the page is load and not only during the first load (the second
one is the right way !).

Try to do this:

if(!IsPostBack)
{
//....first load....create or load controls
}

HTH
--
Davide Vernole
MVP ASP/ASP.NET
Microsoft Certified Solution Developer