Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Exposing A Control On A User Control
Message
De
03/04/2009 09:31:21
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01392880
Message ID:
01392974
Vues:
43
>I have created a user control which is a composite of other controls. It is possible to or how do I expose a control on my user control? In other words, I want to make a listbox on my control available in design and/or runtime.

Look in the *.aspx.designer.cs file of your user control. All of your controls should be declared in that file with a protected scope. You could cut them from that file and paste them into the *.aspx.cs file, and change the scope to public. If you change them to public in the *.aspx.designer.cs file you run the risk of having the entire file be automatically generated again overwriting your changes. I am doing this for a few controls and it works well.

Edit: Ignore the above response. The way to do this in ASP.NET is to create a public property in your *.aspx.cs file that points to the friend declaration in the *.aspx.designer.cs file.
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform