Saturday, 25 November 2017

CheckBox Example

CheckBox 
CheckBox control in ASP.NET is used to select or deselect the value. ChechBox is just like a RadioButton control in HTML. The difference between a CheckBox and a RadioButton is that once you have selected a checkbox you are able to deselect it by clicking on it again
Example :

<%@ Page Title="" Language="C#" MasterPageFile="~/RoseindiaMaster.master" 
AutoEventWireup="true" CodeFile="CheckBox.aspx.cs" Inherits="CheckBox" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style3
{
width: 300px;
height:120px;
}
.tdStyle:
{
width:150px;
height:30px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<h2 style="color:Green">CheckBox in ASP.NET 4 , C#</h2>
<table cellpadding="0" cellspacing="0" class="style3">
<tr>
<td class="tdStyle">
<strong>Products</strong></td>
<td class="tdStyle">
<strong>Selected Products</strong></td>
</tr>
<tr >
<td class="tdStyle">
<asp:CheckBox ID="CheckBox1" runat="server" Font-Bold="True" 
Font-Names="Shruti" ForeColor="#145765" 
Text="Tea" />
</td>
<td>
<asp:Label ID="Label1" runat="server" Font-Bold="True" ForeColor="#000099"></asp:Label>
</td>
</tr>
<tr>
<td class="tdStyle">
<asp:CheckBox ID="CheckBox2" runat="server" Font-Bold="True" 
Font-Names="Shruti" ForeColor="#145765" 
Text="Coffee" />
</td>
<td>
<asp:Label ID="Label2" runat="server" Font-Bold="True" ForeColor="#000099"></asp:Label>
</td>
</tr>
<tr>
<td class="tdStyle">
<asp:CheckBox ID="CheckBox3" runat="server" Font-Bold="True" 
Font-Names="Shruti" ForeColor="#145765" 
Text="Burger" />
</td>
<td>
<asp:Label ID="Label3" runat="server" Font-Bold="True" ForeColor="#000099"></asp:Label>
</td>
</tr>
</table>
<br />
<asp:Button ID="button1" runat="server" Text="Select" onclick="button1_Click" 
Width="76px" />
</div>
</asp:Content>




No comments:

Post a Comment