Results 1 to 2 of 2

Thread: [2005] Client side label update

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    [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()
    ~~~~~~~~~~~~~

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width