Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Method to set all controls Enabled property to false
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01319086
Message ID:
01319093
Vues:
29
This message has been marked as the solution to the initial question of the thread.
>
>When I set this property, I want to set all its inner controls Enabled property to the passed value.

You can iterate over the Controls collection to do this.

>Also can I have this as a static method in our public static class? If yes, what should I pass to this method?

Sure. You could pass in either a UserControl, or a ControlCollection.
public static void SetEnabled(ControlCollection cc, bool enabled)
{
    foreach (Control control in cc)
    {
        WebControl webControl = control as WebControl;
        if (webControl != null)
            webControl.Enabled = enabled;
    }
}
This isn't recursive, but should point you in the right direction.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform