web 2.0

ASP.NET(vb.net) & Checkbox - asp:CheckBox

ASP.NET(vb.net) & Checkbox - asp:CheckBox - asp:CheckBox : Creates a check box control that allows the user to switch between a true or false state.

ShotDev Focus:
- ASP.NET(vb.net) & Checkbox - asp:CheckBox

ASP.NET(vb.net) & Checkbox - asp:CheckBox

Tag Control :

<asp:CheckBox id="CheckBox1"
AutoPostBack="True|False"
Text="Label"
TextAlign="Right|Left"
Checked="True|False"
OnCheckedChanged="OnCheckedChangedMethod"
runat="server"/>

Example

CheckBox.aspx

<%@ Page Language="VB" %>
<script runat="server">
Sub btnSubmit_OnClick(Obj as Object, e As EventArgs)
IF Me.CheckBox1.Checked = True Then
Me.lblText1.Text = "CheckBox1 Checked"
Else
Me.lblText1.Text = "CheckBox1 Not Checked"
End IF

IF Me.CheckBox2.Checked = True Then
Me.lblText2.Text = "CheckBox2 Checked"
Else
Me.lblText2.Text = "CheckBox2 Not Checked"
End IF
End Sub

Sub CheckBox3_CheckedChanged(Obj As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
IF Me.CheckBox3.Checked = True Then
Me.lblText3.Text = "CheckBox3 Checked"
Else
Me.lblText3.Text = "CheckBox3 Not Checked"
End IF
End Sub

</script>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form runat="server">
<asp:CheckBox id="CheckBox1" runat="server" Text="Option 1"></asp:CheckBox>
<asp:CheckBox id="CheckBox2" runat="server" Text="Option 2"></asp:CheckBox>
<asp:CheckBox id="CheckBox3" runat="server" Text="Option 3" AutoPostBack="True"></asp:CheckBox>
<br />
<br />
<asp:Button id="btnSubmit" onclick="btnSubmit_OnClick" runat="server" Text="Submit"></asp:Button>
<br />
<br />
<hr />
<asp:Label id="lblText1" runat="server"></asp:Label>
<br />
<asp:Label id="lblText2" runat="server"></asp:Label>
<br />
<asp:Label id="lblText3" runat="server"></asp:Label>
</form>
</body>
</html>

Screenshot

ASP.NET(vb.net) & Checkbox - asp:CheckBox
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.