Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to determine if a control has a property?
Message
 
To
20/12/2002 15:41:17
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00735015
Message ID:
00735063
Views:
12
Hi Rex,

Here is some sample code to iterate through all the WebControls on the page and check for the property:
For Each ctrlForm In Me.Controls
    If TypeOf ctrlForm Is System.Web.UI.HtmlControls.HtmlForm Then
        Dim ctrl As System.Web.UI.Control
        For Each ctrl In ctrlForm.Controls
            If TypeOf ctrl Is System.Web.UI.WebControls.WebControl Then
                If Not (ctrl.GetType().GetProperty("TabIndex") Is Nothing) Then
                    'Put your code here
                    Response.Write(ctrl.GetType.ToString() + "<br>")
                End If
            End If
        Next
        Exit For
    End If
Next
>All,
>
>Is there a way to tell if an object on a page has a particular property? I want to iterate through all controls on a page and get the id of the control with the lowest TabIndex. If I get a control that does not have a TabIndex property and try to get it's value I will get an error, so I need to determin if a given control has a TabIndex property.
>
>TIA
>
>Rex
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform