Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
User Controls
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Titre:
Divers
Thread ID:
00759524
Message ID:
00759687
Vues:
19
Thanks, Dave. I discovered the LoadControl() method after I posted my original question. Is there *any* other way of doing this? I don't really like having to have the path and file name hardcoded like this.

I've wondered if maybe I should be using Custom WebControls instead of UserControls, but from what I understand, there's no design surface for those. Is that correct? (I just started looking at that now).

~~Bonnie


>>It doesn't show up on the page. If I just add a plain old TextBox instead of a UserControl, it works fine.
>>
>>Any ideas what I might be missing?
>
>Here is some code from the IBuySpy sample application for dynamically loading UserControls onto a web page. This is a great sample app for learning how to dynamically load usercontrols.
>
>LeftPane.Controls.Add(Page.LoadControl("~/DesktopModules/SignIn.ascx"));
>
>
>You should be putting this into the Page_Init event handler, not the Page_Load event handler because of the way that the events fire.
>
>You can debug your aspx pages by adding trace=true at the top and it will show you all the control hierarchy at runtime on your page. Using trace.write will output debug statements at the bottom of the page.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform