Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add TextBox To Page
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01451101
Message ID:
01451159
Vues:
18
>How do you add a textbox to an asp page?
>
>When I try this:
>
>
>        TextBox TextBox1 = new TextBox();
>        this.Controls.Add(TextBox1);
>
>
>I get a page error "Control 'ctl02' of type 'TextBox' must be placed inside a form tag with runat=server. "
>
>Is there no way to do this in C# in the page_load? Or must I do it with tags?

You are trying to add it to the Page (I assume that's what 'this' is?)
Add it instead to the element which will contain it. For example using the default webform generated by VS:
form1.Controls.Add(TextBox1);
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform