Tuesday, 29 July 2014

How to hide visible ASP.NET CheckBox Programmatically

How to hide visible ASP.NET CheckBox Programmatically

  1. <%@ Page Language=“C#” %>

  2. <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

  3. <script runat=“server”>
  4.     protected void Button1_Click(object sender, System.EventArgs e)
  5.     {
  6.         CheckBox1.Visible = false;
  7.         Label1.Text = “CheckBox Hide.”;
  8.     }
  9.     protected void Button2_Click(object sender, System.EventArgs e)
  10.     {
  11.         CheckBox1.Visible = true;
  12.         Label1.Text = “CheckBox Visible.”;
  13.     }
  14. </script>

  15. <html xmlns=“http://www.w3.org/1999/xhtml”>
  16. <head id=“Head1″ runat=“server”>
  17.     <title>How to hide, visible CheckBox programmatically</title>
  18. </head>
  19. <body>
  20.     <form id=“form1″ runat=“server”>
  21.     <div>
  22.         <h2 style=“color:Green”>asp.net CheckBox example: Hide, Visible</h2>
  23.         <asp:Label
  24.              ID=“Label1″
  25.              runat=“server”
  26.              Font-Size=“Large”
  27.              ForeColor=“Violet”
  28.              >
  29.         </asp:Label>
  30.         <br /><br />
  31.         <asp:CheckBox
  32.              ID=“CheckBox1″
  33.              runat=“server”
  34.              Text=“Check The CheckBox.”
  35.              AutoPostBack=“false”
  36.              ForeColor=“Tomato”
  37.              />
  38.         <br /><br />
  39.         <asp:Button
  40.              ID=“Button1″
  41.              runat=“server”
  42.              ForeColor=“Violet”
  43.              Text=“Hide CheckBox”
  44.              OnClick=“Button1_Click”
  45.              Font-Bold=“true”
  46.              />
  47.         <asp:Button
  48.              ID=“Button2″
  49.              runat=“server”
  50.              Font-Bold=“true”
  51.              ForeColor=“Violet”
  52.              Text=“Visible CheckBox”
  53.              OnClick=“Button2_Click”
  54.              />
  55.     </div>
  56.     </form>
  57. </body>
  58. </html>



No comments:

Post a Comment