G
Guest
How do I access a textbox when it was added to a table cell?
I've tried using the findcontrol function with no result.
I create it as such...
Dim myTable As Table = New Table
Dim Row as TableRow
row = New TableRowI
Answer_1 = New TextBox
Answer_1.Width = New Unit("100px")
Answer_1.Text = " "
cell = New TableCell
cell.Controls.Add(Answer_1)
row.Cells.Add(cell)
myTable.Rows.Add(row)
myTable.ID = "myTable5"
I expected this to work:
tl = CType(pnlBoard.FindControl("myTable" &
CStr(QuestionTypeID)), Table)
tb = CType(tl.Rows(0).Cells(0).FindControl("Answer_1"),
TextBox)
and it doesn't. tb is always "Nothing".
Where am I wrong?
TIA.
I've tried using the findcontrol function with no result.
I create it as such...
Dim myTable As Table = New Table
Dim Row as TableRow
row = New TableRowI
Answer_1 = New TextBox
Answer_1.Width = New Unit("100px")
Answer_1.Text = " "
cell = New TableCell
cell.Controls.Add(Answer_1)
row.Cells.Add(cell)
myTable.Rows.Add(row)
myTable.ID = "myTable5"
I expected this to work:
tl = CType(pnlBoard.FindControl("myTable" &
CStr(QuestionTypeID)), Table)
tb = CType(tl.Rows(0).Cells(0).FindControl("Answer_1"),
TextBox)
and it doesn't. tb is always "Nothing".
Where am I wrong?
TIA.