Change asp label text in asp button action (C#)
<%@ Page Language="C#" %> <script runat="server"> protected void btnAdd_Click(object sender, EventArgs e) { Label1.Text = (Int32.Parse(Label1.Text) + 1).ToString(); Label2.Text = (Int32.Parse(Label2.Text) + 1).ToString(); } </script> <html> <head> <title>Disable View State</title> </head> <body> <form id="form1" runat="server"> <div> Label 1: <asp:Label id="Label1" EnableViewState="false" Text="0" Runat="server" /> Label 2: <asp:Label id="Label2" Text="0" Runat="server" /> <asp:Button id="btnAdd" Text="Add" OnClick="btnAdd_Click" Runat="server" /> </div> </form> </body> </html>