runtime errors. Control '_ctl1' of type 'TextBox' must be placed inside a form tag with runat=server. I am only getting the above errors with anything other than labels. If I use the label sample provided, it works perfectly. Here is the code inside of my class.
Public sub Construct_(pg As Page) Dim lbl As New Label() lbl.id = "lblHello" lbl.Text = "Hello" pg.Controls.Add(lbl) Dim lbl2 As New Label() lbl2.Text = "Another Label" pg.Controls.Add(lbl2) Dim _txtbox As New Textbox() _txtbox.Text = "test" pg.Controls.Add(_txtbox)
End Sub If I rem out the textbox one, it works just fine.
aikeith
Participant
1375 Points
276 Posts
Re: Add controls to current form from a class
Nov 04, 2002 03:17 PM|LINK