[2005] Client side label update
This is code I am using in a control (ascx file). Its not working, how can I get it to work?
At the top:
<%@ Control %>
<script language="VB">
Sub ShowServer()
lblServer.Text = "XXX"
End Sub
</script>
Then later in the control:
<asp:Label ID="lblServer" OnLoad="ShowServer()" runat="server" Text="0"></asp:Label>
This is the error:
c:\inetpub\wwwroot\home2005\Footer.ascx(40) : error BC30456: 'ShowServer' is not a member of 'ASP.footer_ascx'.
AddHandler __ctrl.Load, AddressOf Me.ShowServer()
~~~~~~~~~~~~~
Re: [2005] Client side label update
This is what i did to get it to work based on compiler errors.
Added runat="server" attribute to script tag.
Removed parenthesis after OnLoad="ShowServer"
Added ByVal sender As Object, ByVal e As System.EventArgs arguments to ShowServer method.
Code:
<%@ Control%>
<script runat="server">
Sub ShowServer(ByVal sender As Object, ByVal e As System.EventArgs)
lblServer.Text = "XXX"
End Sub
</script>
<asp:Label ID="lblServer" OnLoad="ShowServer" runat="server" Text="0"></asp:Label>