Author: kcis8rm | Posted on: 8/5/2008 3:48:11 AM | Views : 309

Hi

Please can someone help me understand how to create and access dynamic controls. It is my understanding that if I want to create a text box using c# i'd do it something like this:

TextBox t=new TextBox();
t.ID="text1";
Page.Control.Add(t);
This would then render a textbox control to the page.
I thought that if I wanted to access this control I'd do it in this manor:
TextBox t=(TextBox)Page.FindControl("text1");
However it seems that t is returned as null, which to me means it can't find the control by its ID!
What I'm trying to do is find a way to create controls dynamically from a database, and then access them validating the contents and then storing the values away to another database table. However although I've got as far as createing the controls, I can't find the best way to access them. They can be either textboxes, or dropdownlis ...

Go to the complete details ...