M
Mad Scientist Jr
i'm working on a page that creates a HTML table with a variable number
of textboxes on the fly, like so:
cell = New HtmlTableCell
cell.VAlign = "Top"
TextBoxNext = New TextBox
TextBoxNext.ID = "TextBox" & iLoopRows.ToString
TextBoxNext.Text = ""
cell.Controls.Add(TextBoxNext)
row.Cells.Add(cell) ' Add the cell to the row
my question is, on postback, how do you dynamically reference the
textboxes that were created? my page simply names the controls
"TextBox1", "TextBox2" etc. and puts the number of textboxes in a
hidden field txtExistingControls. Then I'd like to be able to look
through them, like so:
If txtExistingControls.Value > 0 Then
For iLoopRows = 1 To txtExistingControls.Value
txtOut.Text = "Value of " & iLoopRows.ToString & "=" & TextBox
<- how to reference the control?
Next iLoopRows
Else
txtOut.Text = "no controls available"
End If
is there a way to dynamically reference the created controls (as
opposed to by name Textbox1.text etc), without having to resort to
Request.Forms ?
thanks in advance
of textboxes on the fly, like so:
cell = New HtmlTableCell
cell.VAlign = "Top"
TextBoxNext = New TextBox
TextBoxNext.ID = "TextBox" & iLoopRows.ToString
TextBoxNext.Text = ""
cell.Controls.Add(TextBoxNext)
row.Cells.Add(cell) ' Add the cell to the row
my question is, on postback, how do you dynamically reference the
textboxes that were created? my page simply names the controls
"TextBox1", "TextBox2" etc. and puts the number of textboxes in a
hidden field txtExistingControls. Then I'd like to be able to look
through them, like so:
If txtExistingControls.Value > 0 Then
For iLoopRows = 1 To txtExistingControls.Value
txtOut.Text = "Value of " & iLoopRows.ToString & "=" & TextBox
<- how to reference the control?
Next iLoopRows
Else
txtOut.Text = "no controls available"
End If
is there a way to dynamically reference the created controls (as
opposed to by name Textbox1.text etc), without having to resort to
Request.Forms ?
thanks in advance