Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find a control by ID
Message
 
To
02/05/2012 14:57:42
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01543059
Message ID:
01543201
Views:
33
Sounds like a job for JavaScript and/or JQuery. I'm still working my way through the learning curve but I think if you check out the Head First books on JavaScript and JQuery, they have samples that will let you do that. They are excellent books for getting started down this path.

>I need to find a control in a WebForm by ID. I have the code to scan the page by hierarchy. However, this only applies for as long as each control have the runat server. If I have a Body tag with runat server, this is good. Then, it scans for child controls for all runat controls. But, if I have a table defined and in one of the cell I have the runat server, how can I find this control?
>
>This is the recursive method:
>
>
>        ' See if a control ID exists
>        ' expO1 Control
>        ' expC1 ID
>        Public Function IsPageControlExistByID(ByVal toControl As Object, ByVal tcID As String) As Boolean
>            Dim loControl As System.Web.UI.Control = New System.Web.UI.Control
>
>            ' For each control
>            For Each loControl In toControl.Controls
>
>                ' If this is the ID
>                If loControl.ID = tcID Then
>                    Return True
>                End If
>
>                ' If we have child controls
>                If loControl.HasControls Then
>
>                    ' If the control exists
>                    If IsPageControlExist(loControl, tcID) Then
>                        Return True
>                    End If
>
>                End If
>
>            Next
>
>            Return False
>        End Function
>
Linda Harmes
HiBit Technologies, Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform