I,m Developing a project in asp.net 2.0 using c# Dynamically. so i create all server type control at runtime.
like
// Create Dynamic Textbox
for (int a = 1; a < 4; a++)
{
TextBox Textdata = new TextBox();
Textdata.ID = "a" + a;
Textdata.Attributes.Add("runat", "Server");
//Textdata.Attributes.Add("
");
Textdata.EnableViewState = false;
Textdata.MaxLength = 128;
place.Controls.Add(new LiteralControl("
"));
place.Controls.Add(Textdata);
}
how i can store data in a database when i insert data in textbox and we doesnt know Id of textbox.
Loading
Anwar BuchooPosted Jun 30, 2006, 4:43 AM
To get the values, you should use the FindControl("controlid") method like:
TextBox TextA1 = (TextBox)place.FindControl("a1"); //for TextBox a1
You will know the name as it will have a name like a+an integer value.
Cheers