Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I refer to dynamically created controls in code?

Status
Not open for further replies.
Feb 8, 2002
43
US
I dynamically created table, tablecell, and tablerow controls in code. The number of rows in the table is dependent on a number the user enters into a textbox. When the user presses enter, the table is created at run time and placed in a placeholder. In some cells I have added dynamically created textboxes. I then, want the user to enter information into the textboxes.

Here is my question. How do I read the data from the created textboxes into a variable?

(I can't refer to them in code because I get the error that the control hasn't been declared. I understand that it because they doesn't exist in design time.)

If I can't, what's the point, besides labels, of being able to create web controls at runtime?

Thanks.
 
The best way is to put it into a placeholder or a panel. Then when you want to access it simply go through the controls collection of that object and find the control you are looking for.

The reason I say to put it into a Panel rather than simply on the page is so that you only have to loop through the controls in that panel rather than the entire page.

If you need more help I would be glad to oblige That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top