Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programming UserControls
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01330659
Message ID:
01330703
Vues:
15
>>
>>Interesting. Does it mean I can do something like
>>
>>FormView frmRegular = (FormView) this.Page.FindControl("myFormViewName")
>>if ...
>
>Can you? Yes, it should work. However I wouldn't do an explicit cast and I wouldn't hardcode in the control name. If the control doesn't exist your code will throw an exception. Instead, something like:
>
>
>FormView regular = Page.FindControl(this.FormViewNameProperty) as FormView;
>
>if (regular != null)
>
>
>(you'd need to create a property in your user control, I'm using FormViewNameProperty as an example).
>
>You may also need to think about what happens when you've got multiple instances of the same user control on the form.

I only need to attach Client event if my FormName is a particular name (or I just add a property AttachGenderChange or something). I can not have multiple forms active at the same time and each form has only one GeneralInfo control.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform