Referencing value of a dynamically created control

G

Guest

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?
 
D

Davide Vernole [MVP]

Mike said:
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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top