Example of jQuery Validate on Radiobuttonlist using C#
In this post we consider an Example of Radiobuttonlist and validate the Radiobuttonlist using JQuery. As we know that google provide Jquery for performing many operations in asp.net so 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 Radiobuttonlist control these are:
Other Radiobuttonlist related post or example:
How To bind RadioButtonList Control From data base
Access RadioButtonList Item Using VBScript
Use radiobuttonlist with VB
Example of RadioButtonList control.
Html Radio Button
ASP.NET RadioButton Control
Hide radio buttons in JavaScript on button click
Validate ASP.Net RadioButtonList using JavaScript Example
Function of jQuery Validate:
Here we take give jquery function of performing the validation on Radiobuttonlist in asp.net page.
$(document).ready(function() {
$('#btnSubmit').click(function () {
if ($('#rdbtn :radio:checked').length > 0) {
return true;
}
else {
alert('Please chooes one ')
return false;
}
})
})
Function of checkboxlist validation by jQuery Validate Example :
$(document).ready(function() {
$('#btnSubmit').click(function () {
if ($('#chktech input:checked').length > 0) {
return true;
}
else {
alert('Please select atleast one')
return false;
}
})
});
For full code and get example of checkboxlist click here……..
jQuery Validate Example in asp.net:
<%@ PageLanguage="C#"AutoEventWireup="true"CodeFile="Radiobuttonlist_validation.aspx.cs"
Inherits="Radiobuttonlist_validation"%>
<!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>Validate asp.net radiobuttonlist in JQuery</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 ($('#rdbtn :radio:checked').length > 0) {
return true;
}
else {
alert('Please chooes one ')
return false;
}
})
})
</script>
<style type="text/css">
.style1
{
font-size: x-large;
font-weight: bold;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<spanclass="style1">Select one :</span>
<br/>
<br/>
<asp:RadioButtonList ID="rdbtn" runat="server"RepeatDirection="Horizontal">
<asp:ListItem Value="1" Text="option1" />
<asp:ListItem Value="2" Text="option2" />
</asp:RadioButtonList>
<br/>
<asp:Button ID="btnSubmit" Text="click" runat="server" BackColor="#990000"
BorderColor="#990033" ForeColor="White"Height="44px"Width="130px"/>
</div>
</form>
</body>
</html>
Example of jQuery Validate on Radiobuttonlist
Exampling asp.net jquery Example:
In this example we take a radiobuttonlist with 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
Example of Adding ToolTip for each Dropdown List Item in C#
DropDownList Programmatically add items on Button Click in ASP.Net using C# Example
Containing sub string in string Using JavaScript
Display tooltip from database for dropdownlist items in asp.net c# example
How to Add Reference of .dll file in Asp.net web site/Application
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 use Captcha in asp.net Second post
Sending mail from web application using google Mail ID
How to Make Data Table By C# code in Asp.net Programming:
how to add capcha in Asp.net programming
how to use CAPTCHA in asp.net
Example of Crystal report(Crystal_report_in asp.net programming )
How to Make a HTML Table by C# code in asp.net programming
Example jQuery Validate on CheckBoxList using C#