They'll need to be recreated everytime. The veiwstate only stores
information about the control, not the control it self.
-- Alex Papadimoulis
Yeah, that's what conclusion I seemed to come to but thought I'd see if I
was missing something. Here is some code for basically how I solved it.
ASPX PAGE
<body>
<form id="Form1" method="post" runat="server">
<asp:Button Runat=server ID=btnAdd Text=Add />
<asp:Button Runat=server ID=btnPost Text=Post/>
<asp
laceHolder ID=place Runat=server EnableViewState=True />
</form>
</body>
CODE BEHIND
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
'--> RECREATE DYNAMIC CONTROLS IF NEEDED <--
If Request.Form("txtb") <> "" Then
Dim txtbox As New TextBox
txtbox.Text = Request.Form("txtb")
txtbox.ID = "txtb"
txtbox.EnableViewState = True
Me.place.Controls.Add(txtbox)
End If
End Sub
Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
Dim txtbox As New TextBox
txtbox.Text = Now.ToString
txtbox.ID = "txtb"
txtbox.EnableViewState = True
Me.place.Controls.Add(txtbox)
End Sub
-Steve