Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i created dynamic text boxes in c#, but i didn't find out that id as well as textboxes text. any body know how to find out the text box id and text box text, you will share the information for me.



Thanks in Advance
Posted
Comments
[no name] 19-Oct-12 6:47am    
Why are you not saving the id's when you create the text boxes?
penigandlakoti 19-Oct-12 6:50am    
i create one text box, user will enter number of text boxes, that text boxes will be visible.

if i will enter "5" in that textbox, 5 textboxes will visible.user enter his information in that text boxes , that text will be save in db.
[no name] 19-Oct-12 6:55am    
And so? What does that have to do with you saving the id's of the text boxes when you create them?
penigandlakoti 19-Oct-12 7:10am    
i didn't find out that dynamic created textbox text with that textbox id.
[no name] 19-Oct-12 7:12am    
And how are we supposed to know that? How are we supposed to know what you have done when you have not shown us what you have done?

1 solution

protected void Page_Load(object sender, EventArgs e)
{
TextBox new_textbox = new TextBox();
new_textbox.ID = "txt" + 1;
new_textbox.Text = "";
PlaceHolder1.Controls.Add(new_textbox);
}

protected void Button1_Click(object sender, EventArgs e)
{
string OptionID = "txt" + 1;
TextBox tb = (TextBox)PlaceHolder1.FindControl(OptionID);
Response.Write(tb.Text);


}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900