Mega Code Archive

 
Categories / ASP.Net / Page
 

Find Control in a page

<%@ Page Language="vb" %> <html>    <head>       <title>FindControl method example</title>       <script runat="server">          Sub Page_Load()             Dim TheControl As Control = FindControl("Message")             If Not TheControl Is Nothing Then                Dim TheLabel As Label = CType(TheControl, Label)                TheLabel.Text = "Found the label named Message!"                TheLabel.BackColor = System.Drawing.Color.Blue             End If          End Sub       </script>    </head> <body>    <asp:label id="Message" runat="server"/> </body> </html>