T
Tom wilson
I'm trying to create dynamic controls in ASP.Net. It's driving me
nuts. I keep getting the error:
Control '16' of type 'RadioButton' must be placed inside a form tag
with runat=server.
Dim Place1 As New PlaceHolder
Controls.Add(Place1)
For y = 1 To Choices.RecordCount
Choices.MoveTo(y)
Dim Radio As New RadioButton
Radio.ID = choices.ID
Radio.Text = choices.ChoiceText
Radio.GroupName = Q.ID
Place1.Controls.Add(Radio)
If I do Controls.Add(Radio) I get the above error. So I created a
placeholder in design view (there's nothing there since all page
content is dynamic). It added the radios but at the bottom of the
form. So I modified the code to dynamically create the placeholder
(as above). I STILL get this error.
Do I have to do a:
response.write("<FORM etc etc... runat=server>")
before every checbox creation?
Why doesn't it add the tags itself while its creating the controls?
How do I add a control without getting that needless error at every
turn?
Thanks!
nuts. I keep getting the error:
Control '16' of type 'RadioButton' must be placed inside a form tag
with runat=server.
Dim Place1 As New PlaceHolder
Controls.Add(Place1)
For y = 1 To Choices.RecordCount
Choices.MoveTo(y)
Dim Radio As New RadioButton
Radio.ID = choices.ID
Radio.Text = choices.ChoiceText
Radio.GroupName = Q.ID
Place1.Controls.Add(Radio)
If I do Controls.Add(Radio) I get the above error. So I created a
placeholder in design view (there's nothing there since all page
content is dynamic). It added the radios but at the bottom of the
form. So I modified the code to dynamically create the placeholder
(as above). I STILL get this error.
Do I have to do a:
response.write("<FORM etc etc... runat=server>")
before every checbox creation?
Why doesn't it add the tags itself while its creating the controls?
How do I add a control without getting that needless error at every
turn?
Thanks!