Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to ForEach Page controls?
Message
 
 
À
13/11/2006 15:51:47
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
Divers
Thread ID:
01169266
Message ID:
01169299
Vues:
8
>>>>I am looking at the properties of the Page object but don't seem to find how to scan through the controls that this object has. I want to find all controls that have a property .Text. Is Page the right object?
>>>
>>>Once you have a reference to the object, you can use an approach such as the following:
>>>
>>>
>>>            For Each loControl In loControlGenericControl.Controls
>>>                If TypeOf loControl Is System.Web.UI.HtmlControls.HtmlForm Then
>>>                    Return CType(loControl, System.Web.UI.HtmlControls.HtmlForm)
>>>                End If
>>>            Next
>>>
>>>
>>>This is just an example. You would need to adjust the code to fit your own needs.
>>
>>Thank you very much.
>
>Dmitry,
>
>You must also handle nested controls or you might miss some.

Keith,

Thank you. Although I don't have any nested controls. On top of it, I could not figure out how to Foreach Page.controls and determine if they have the property I am looking for (I will need to work more on my C#). So I decided, for now, to hard code the control by name.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform