ASP.NET

1. ASP.NET Introduction 2. Comp of .Net Framework 3.5 3. Sys.Req for VS 2008 4. ASP.NET Envrmnt Setup 5. VS2010 Ultimate Sys.Req 6. Installing VS 2010 7. VS 2012 Sys.Req 8. Installing VS Exp 2012 9. Start the VS 2008 10. Application Life Cycle 11. Page Life Cycle 12. Page Life Cycle Events 13. ASP.NET Example 14. Event Handling 15. Default Events 16. Server Side 17. Request Object 18. Response Object 19. Server Controls 20. Server Controls Properties 21. Server Controls Methods 22. HTML Server Controls 23. Client Side 24. ASP.NET Basic Controls 25. TextBox Control 26. CheckBox Controls 27. RadioButton Controls 28. ListBox Control 29. HyperLink Control 30. Image Control 31. BulletedList Control 32. ASP.NET Directives 33. Implements Directive 34. Master Type Directive 35. Page Directive 36. PreviousPage Type 37. Managing State 38. Control State 39. Cookies 40. Query Strings 41. Server-Side State 42. Session State 43. Validation Controls 44. Required FieldValidator 45. Range Validator 46. Compare Validator 47. RegularExpressionValidator 48. Custom Validator 49. Validation Summary 50. Data Source Control 51. AdRotator Control 52. Calendar Control 53. Calendar Control Example 54. Panel Control 55. Panel Control Example 56. Multi Views Control 57. MultiView & View controls 58. MultiView Control Example 59. FileUpload Control 60. FileUpload Control Eg 61. AJAX Control 62. UpdatePanel control 63. UpdateProgress Control 64. Custom Controls 65. Custom Control Eg 66. Personalization 67. Create Simple Profile 68. ADO.NET 69. ADO.NET Objects 70. DataTable 71. DataRow 72. DataColumn 73. Object Example 74. Error Handling 75. Tracing Errors 76. Debugger 77. Security 78. Authentication 79. Authorization 80. LINQ 81. LINQ Query Operators 82. LINQ Example 83. Caching 84. Data Caching 85. Output Caching 86. Object Caching 87. Web Services 88. Create Web Services Eg 89. Web & Machine.config 90. Settings Schema 91. ASP.NET Deployment 92. XCopy Deployment 93. Web Setup Project 94. ASP Interview Part 1 95. ASP Interview Part 2 96. ASP Interview Part 3 97. ASP Interview Part 4 98. ASP Interview Part 5 99. ASP Interview Part 6
Pr.Pg Next Pg

CheckBox Controls tutorials

  • A CheckBox control provides a means for a user to select Boolean data (i.e., Yes/No or True/False

  • The CheckBox and RadioButton controls implement the ICheckBoxControl interface. This interface provides for a single property called Checked, and a single event called CheckedChanged.

 

Syntax:

Basic syntax for check box is:

<asp:CheckBox ID=”chkpass” runat= “Server”> </asp:CheckBox>

  • The following table shows the list of properties of the CheckBox Control:

 

Properties

Description

AutoPostBack

Specifies value that indicates whether an automatic postback to the server occurs when the CheckBox control loses focus

AccessKey

access key, allows you to quickly navigate to the Web server control.

CausesValidation

Gets or sets a value indicating whether validation is performed when the CheckBox control is selected.

Checked

Determines a value indicating whether the CheckBox control is checked

InputAttribute

InputAttribute names and values used for the Input element for the CheckBox control

LabelAttributes

LabelAttribute names and values used for the Label element for the CheckBox control

Text

Specifies the text label associated with the CheckBox.

TextAlign

Specifies the alignment of the text label associated with the CheckBox control

ValidationGroup

Specifies the group of controls for which the CheckBox control causes validation when it posts back to the server.

OnCheckedChanged

The name of the function to be executed when the Checked property has changed

ToolTip

Specifies the text displayed when the mouse pointer hovers over the Web server control

Visible

Specifies a value that indicates whether a server control is rendered as UI on the page

 

Example:

  • From the below examples we have created 4 CheckBox control in an CheckBoxControl.aspx file. Every checkbox control have name, like ASP.NET, VB.,NET, C#, JAVA. Select any course and Click on the Select button.Checked course will be display.

CheckBox1Control.aspx.cs Code:


 

Following example shows the use of ASP.NET Basic Web Controls (CheckBox Controls):

Sam Sir

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

 

public partial class CheckBox1Control : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

 

}

protected void btnselect_Click(object sender, EventArgs e)

{

if(CheckBox1.Checked== true)

{

lblmsg.Text = "ASP.NET Selected";

}

else if (CheckBox2.Checked == true)

{

lblmsg.Text = "VB.NET Selected";

}

else if (CheckBox3.Checked == true)

{

lblmsg.Text = "C# Selected";

}

else if (CheckBox4.Checked == true)

{

lblmsg.Text = "JAVA Selected";

}

else

{

lblmsg.Text = "";

}

}

}

 

 

 

CheckBox1Control.aspx Code:

 

Following example shows the use of ASP.NET Basic Web Controls (CheckBox Controls):

Sam Sir

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CheckBox1Control.aspx.cs" Inherits="CheckBox1Control" %>

 

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

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>cbtSAM ASP.NET CheckBox Controls Example</title>

<style type="text/css">

.style1

{

width: 100%;

}

</style>

</head>

<body>

<form id="form1" runat="server">

<div>

<table class="style1">

<tr>

<td>

CheckBox Control Example</td>

</tr>

<tr>

<td>

&nbsp;</td>

</tr>

<tr>

<td>

Select the Course</td>

</tr>

<tr>

<td>

<asp:CheckBox ID="CheckBox1" runat="server" Text="ASP.NET" />

</td>

</tr>

<tr>

<td>

<asp:CheckBox ID="CheckBox2" runat="server" Text="VB.NET" />

</td>

</tr>

<tr>

<td>

<asp:CheckBox ID="CheckBox3" runat="server" Text="C#" />

</td>

</tr>

<tr>

<td>

<asp:CheckBox ID="CheckBox4" runat="server" Text="JAVA" />

</td>

</tr>

<tr>

<td>

&nbsp;</td>

</tr>

<tr>

<td>

<asp:Button ID="btnselect" runat="server" onclick="btnselect_Click"

Text="Select" />

</td>

</tr>

<tr>

<td>

Selected Course<br />

</td>

</tr>

<tr>

<td>

<asp:Label ID="lblmsg" runat="server"></asp:Label>

</td>

</tr>

</table>

</div>

</form>

</body>

</html>

Output

 

 

asp.net check box example

 

Pr.Pg border                                              Next Pg