Dynamically Added Controls Question

  • Thread starter Thread starter Jason MacKenzie
  • Start date Start date
J

Jason MacKenzie

I'm sure this is simple but I'm not sure how to persist dynamically created
controls.

If Not IsPostBack Then

Dim txt As New TextBox
txt.Text = "Test"

CType(Me.FindControl("Form1"), HtmlForm).Controls.Add(txt)

End If

I have a button on this simple page and when I click it the page posts back
and the textbox disappears. How can prevent this from happening?

Thanks,

Jason MacKenzie
 
Back
Top