Live Chat Icon For mobile
Live Chat Icon

Why do I get error message ‘The control ‘_ctl1’ of type ‘TextBox’ must be inside a form label with runat=server’ while trying to place a control inside a form dynamically

Platform: ASP.NET| Category: Controls

You are probably adding the textbox into the Page directly instead of adding it to the Page’s form. Try doing this:

VB.NET


Me.Page.Controls(1).Controls.Add(txtboxctrl)

C#


this.Page.Controls[1].Controls.Add(txtboxctrl);

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.