Net-informations.com
SiteMap  | About    

Checkbox Control

CheckBoxes allow the user to make multiple selections from a number of options and CheckBoxes comes with a caption, which you can set in the Text property.

checkbox-control

vb.net

  CheckBox1.Text = "CheckBox"

C#

  CheckBox1.Text = "CheckBox";

We can decide whether the checkbox is clicked or not by its checked property.

vb.net
  If CheckBox1.Checked = True Then
    Label2.Text = "Checkbox Clicked "

End If

C#
  if (CheckBox1.Checked == true)
  {
    Label2.Text = "Checkbox Clicked";

}

The following ASP.Net program detect whether the Checkbox is clicked or not and display the message on Label control.

Default.aspx

  

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>Untitled Page</title>
</head>
<body>
	<form id="form1" runat="server">
	<div>
		<asp:CheckBox ID="CheckBox1" runat="server" Text="CheckBox"
			AutoPostBack="True"  oncheckedchanged="CheckBox1_CheckedChanged" />
	   <br />
		<asp:Label ID="Label2" runat="server" Text="Label2"></asp:Label>
	</div>
	</form>
</body>
</html>


Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.cs
default.aspx.vb





net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.