Mega Code Archive

 
Categories / ASP.Net Tutorial / ASP Net Controls
 

Import properties, events and methods of CheckBox control

AccessKey:      specify a key that navigates to the TextBox control. AutoPostBack:   post the form containing the CheckBox back to the server automatically when the CheckBox is checked or unchecked. Checked:        get or set whether the CheckBox is checked. Enabled:        disable the TextBox. TabIndex:       specify the tab order of the check box. Text:           provide a label for the check box. TextAlign:      align the label for the check box. Possible values are Left and Right. Focus:          set the initial form focus to the check box. CheckedChanged: Raised on the server when the check box is checked or unchecked. <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">     protected void btnSubmit_Click(object sender, EventArgs e)     {         lblResult.Text = chkNewsletter.Checked.ToString();     } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">     <title>Show CheckBox</title> </head> <body>     <form id="form1" runat="server">     <div>     <asp:CheckBox         id="chkNewsletter"         Text="Receive Newsletter?"         Runat="server" />     <br />     <asp:Button         id="btnSubmit"         Text="Submit"         OnClick="btnSubmit_Click"         Runat="server" />     <hr />     <asp:Label         id="lblResult"         Runat="server" />     </div>     </form> </body> </html>