Mega Code Archive

 
Categories / ASP.Net / Asp Control
 

Button event Handler (C#)

<%@ Page Language="C#" Debug="true"%> <script runat="server">     void ClickHandler(object sender, EventArgs e)     {         if (ExtraInfoBox.Checked)         {             Message.Text = "You will hear from us shortly";         }         else         {             Message.Text = "You will not receive any further information from us";         }     } </script> <html> <head> </head> <body>     <form runat="server">         <asp:CheckBox id="ExtraInfoBox" runat="server" Text="Click here to receive extra information"></asp:CheckBox>         <br />         <br />         <asp:Button id="Button1" onclick="ClickHandler" runat="server" Text="Click here to submit"></asp:Button>         <br />         <br />         <asp:Label id="Message" runat="server"></asp:Label>     </form> </body> </html>