Reputation: 999
In my aspx page,when a user clicks on a Location "LinkButton", a new textbox should be dynamically added in the page.User can add a maximum of 10 textboxes. Also, user can navigate to another page B from this page A.When he comes back to page A, all his textboxes should be persisted. How do I achieve this functionality?
Thanks.
Upvotes: 0
Views: 182
Reputation: 2271
I would create a user control with a place holder object in it and then write something like:
if(NumberOfTextBoxes <= 10)
{
TextBox tb = new TextBox();
Placeholder1.Controls.Add(tb);
NumberOfTextBoxes++;
}
For reference I would recommend:
Upvotes: 2
Reputation: 19637
You need to keep information in the user's session about how many text boxes to show (and possibly their content). In the page's Init (?) handler you will need to add the text boxes each time.
Upvotes: 0