URL to be unblocked: __________________
The underline being a text box. Below this field, I have a text link that says "Add another", which essentially creates this:
URL to be unblocked: __________________
__________________
Again, both underlines being text boxes. The user can continue to hit "add another" as many times as he/she would like, dynamically creating many textboxes. On the code-behind, I have a property called URLControlsCount that gets and sets a viewstate variable that tracks how many textboxes should show up (if the variable does not yet exist in the ViewState, it returns 1 so that at least one textbox will always show up, as you will see below). Now, on Page_Init, I call a function called CreateURLControls() which contains the following:
Expand|Select|Wrap|Line Numbers
- Dim i As Integer
- For i = 1 to URLControlsCount
- Dim newTextBox As TextBox = New TextBox()
- newTextBox.ID = "url" + i.ToString()
- URLFieldsPlaceHolder.Controls.Add(newTextBox)
- Next
Expand|Select|Wrap|Line Numbers
- Dim newTextBox As TextBox = New TextBox()
- URLControlsCount += 1
- newTextBox.ID = "url" + URLControlsCount.ToString()
- URLFieldsPlaceHolder.Controls.Add(newTextBox)
Can anyone shed some light? Do I need to store URLControlsCount in a session variable or something to get around the issue? Thanks!!