views:

69

answers:

2

Hi,

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.

A: 

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.

Tor Haugen
+1  A: 

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:

Jesse Dearing