Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding Web Control To Page In Page_Load
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01451004
Message ID:
01451006
Vues:
26
Because I want to be able to deterine at run-time which control to use.


>Why do you want to add your user control in code and not in design time? Adding controls in run-time is quite tricky.
>
>>I'm completely new to ASP.Net so...
>>
>>I created a user control with some fields on it. I want to add it to a page in Page_Load. I'm assuming that this is the place to do it.
>>So I dropped a panel on the page, then in Page_Load I have:
>>
>>
>>Params_AssCumLtDetail Params = new Params_AssCumLtDetail();
>>pnlParams.Controls.Add(Params);
>>
>>
>>When I run it, I don't see anything.
>>
>>When I do this:
>>
>>
>>Label myLabel = new Label ( );
>>myLabel.Text = "Sample Label"
>>pnlParams.Controls.Add ( myLabel );
>>
>>
>>The label appears.
>>
>>So what's wrong here?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform