Example of jQuery Validate on Radiobuttonlist in Asp.Net using C#

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:



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;
                }
            })
        });

jQuery Validate Example in asp.net:

Example of jQuery Validate on Radiobuttonlist

<%@ Page Language="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">
      
                    <span class="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
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:

Comments

Popular posts from this blog