Example jQuery Validate on CheckBoxList using C#
Example of jQuery Validate on CheckBoxList in Asp.Net using C#
In this post we consider a Example of checkboxlist and validate the checkboxlist using JQuery. As we know that google provide many Jquery for performing many examples in asp.net so if you want to download then you do otherwise you can use these jqury by giving link in your application. In this asp.net tutorial Example blog we explain many post related to the checkboxlist control these are :
Other Checkbox related post aur example:
- Check Uncheck all asp.net CheckBox in asp.net using jQuery
- Check Uncheck all html CheckBox controls using jQuery:
- How to use CheckBox control in asp.net
- How to check If checkbox Is checked in asp.net
- Validation checkbox control using JavaScript:
- Checkbox list Example using javascript
- Asp.net Checkbox List
- Validate ASP.Net RadioButtonList using JavaScript Example
- Asp-checkboxlist control demo:
- Checkboxlist in asp.net(control example)
- Asp checkboxlist Example using C#
Function of jQuery Validate:
Here we take give jquery function of performing the
validation on checkboxlist in asp.net page.
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$('#btnSubmit').click(function () {
if ($('#chktech
input:checked').length > 0) {
return true;
}
else {
alert('Please select atleast one technology')
return false;
}
})
});
Function of jQuery for select one checkbox from checkboxlist:
This function is use to selecting checkbox for given
checkboxlist.
$(function () {
$("[id*=chkAll]").bind("click", function
() {
if ($(this).is(":checked")) {
$("[id*=chk] input").attr("checked", "checked");
} else {
$("[id*=chk] input").removeAttr("checked");
}
});
$("[id*=chkFruits] input").bind("click", function
() {
if ($("[id*=chk]
input:checked").length == $("[id*=chk]
input").length) {
$("[id*=chkAll]").attr("checked", "checked");
} else {
$("[id*=chkAll]").removeAttr("checked");
}
});
});
jQuery Validate Example in asp.net
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="vcheckbox.aspx.cs"
Inherits="vcheckbox"
%>
<!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 id="Head1" runat="server">
<title>jQuery Validate on CheckBoxList in Asp.Net using
C#</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript"
language="javascript">
$(document).ready(function () {
$('#btnSubmit').click(function () {
if ($('#chktech
input:checked').length > 0) {
return true;
}
else {
alert('Please select atleast one technology')
return false;
}
})
});
</script>
</head>
<body>
<form id="form" runat="server">
<div>
<table>
<tr>
<td>
<b>Select Option :</b>
</td>
<td>
<asp:CheckBoxList ID="chktech"
runat="server">
<asp:ListItem Value="1" Text="Option1" />
<asp:ListItem Value="2" Text="Option2" />
<asp:ListItem Value="3" Text="Option3" />
<asp:ListItem Value="4" Text="Option4" />
<asp:ListItem Value="5" Text="Option4" />
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnSubmit"
Text="Submit"
runat="server"
/>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Exampling asp.net jquery
Example:
In this example we take
a checkboxlist the some items and consider one asp.net button control also. Now
, the on client check event use jquery function.
Other asp.net related Examples:
- On
mouse over event show tooltip dropdownlist items by using C# example
- Display tooltip from database for dropdownlist items in asp.net c# example
- Example of Adding ToolTip for each Dropdown List Item in C#
- How to bind data to textbox inside Gridview in asp.net using C#
- Example of C# for Bind Data to asp.net Textbox inside gridview control:
- Bind Data to asp.net textbox control in inside of gridview Using C# Example
- Add tooltip for dropdownlist items in asp.net with C# Example
- DropDownList Programmatically add items on Button Click in ASP.Net using C# Example
- Containing sub string in string Using JavaScript
- Hide radio buttons in JavaScript on button click
- Add or bind tooltip for dropdownlist items in asp.net by C#
- How to use asp ListView control in asp.net:
- How to Add Reference of .dll file in Asp.net web site/Application
- how to use Captcha in asp.net Second post
- how to use CAPTCHA in asp.net
- Sending mail from web application using google Mail ID
- How to Make a HTML Table by C# code in asp.net programming
- How to Make Data Table By C# code in Asp.net Programming:
- how to add capcha in Asp.net programming
- Example of Crystal report(Crystal_report_in asp.net programming )
Comments
Post a Comment