TableCell.Text property overwrites dynamic control

  • Thread starter Thread starter Bob Voss
  • Start date Start date
B

Bob Voss

If I add a hidden input control to a tablecell and then set the cell's text
property, the hidden control is not output. If I set the text first, then
the hidden control is output but the text is not. No errors are generated.
I can make it work by adding a literal control instead of using the text
property, but why doesn't the "simple" method work?

Dim tCell As TableCell = New TableCell
Dim thidden As HtmlInputHidden = New HtmlInputHidden
thidden.ID = "h1"
thidden.Value = "hidden text"
tCell.Controls.Add(thidden)
tCell.Text = "visible text"
tRow.Cells.Add(tCell)
 
Back
Top