Dynamic textbox inside table won't reset text

Doctor Tech

New Member
I've got a strange problem with a textbox dynamically created inside a table. I've made a small example with two textboxes one inside and one outside the table. The page comes up fine. I change the text in BOTH the regular textbox and the table textbox and click submit. The page load executes and I verify that tb2.text is the correct value, but when the page redraws the table textbox has the text that I modified rather than the text set in page-load. This makes no sense. It's like the table is somehow remembering, even though the textbox has to be recreated after the page reload.<BR><BR>Any ideas?<BR><BR>Thanks,<BR>Deanna<BR><BR>================================================== =====================<BR> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As<BR>System.EventArgs) Handles MyBase.Load<BR> Dim stg As String = "TableTextBox"<BR><BR> Dim r As New HtmlTableRow()<BR> Dim tb As New TextBox()<BR> Dim c = New HtmlTableCell()<BR><BR> tb.ID = stg<BR> c.Controls.Add(tb)<BR> r.Cells.Add(c)<BR> htmltable.Rows.Add(r)<BR><BR> Dim tb2 As TextBox<BR> tb2 = Page.FindControl(stg)<BR> tb2.Text = "table textbox from page_load"<BR> TextBox1.Text = "textbox1 from page_load"<BR><BR> End Sub<BR>
 
Back
Top