asp:link button event to change the label text : Link Button « Asp Control « ASP.Net






asp:link button event to change the label text

<%@ Page Language="VB" %>
<script runat="server">
    Sub LinkButton1_Click(sender As Object, e As EventArgs)
      Label1.Text = "This is item 1"
    End Sub
    
    Sub LinkButton2_Click(sender As Object, e As EventArgs)
      Label1.Text = "Some stuff about item 2"
    End Sub
    
    Sub LinkButton3_Click(sender As Object, e As EventArgs)
      Label1.Text = "And now onto item 3"
    End Sub

</script>
<html>
<body>
    <form runat="server">
    <table style="WIDTH: 300px; HEIGHT: 150px" height="20">
        <tbody>
            <tr>
                <td>
                    <asp:LinkButton id="LinkButton1" onclick="LinkButton1_Click" runat="server">Item 1</asp:LinkButton>
                </td>
                <td>
                    <asp:LinkButton id="LinkButton2" onclick="LinkButton2_Click" runat="server">Item 2</asp:LinkButton>
                </td>
                <td>
                    <asp:LinkButton id="LinkButton3" onclick="LinkButton3_Click" runat="server">Item 3</asp:LinkButton>
                </td>
            </tr>
        </tbody>
    </table>
    <asp:Label id="Label1" runat="server">Label</asp:Label>
    </form>
</body>
</html>

           
       








Related examples in the same category

1.asp:linkbutton: command name and arguments
2.OnCommand, for asp:linkbutton