In this short article I will explain how to validate ASP.Net RadioButtonList using jQuery in ASP.Net. jQuery ValidationEngine plugin is used to perform validation of ASP.Net RadioButtonList.
You might also like to read:
 
 
ASP.Net RadioButtonList Validation using jQuery ValidationEngine Plugin
Inside the jQuery document ready event handler, the ValidationEngine plugin is applied to the RadioButtonList and then validate[required] CSS class is applied to each RadioButton inside the RadioButtonList.
Finally a click event handler is attached to the Button control, when the button is clicked the RadioButtonList is validated and based on that it returns true or false.
<link href="ValidationEngine.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">script>
<script type="text/javascript" src="http://cdn.ucb.org.br/Scripts/formValidator/js/languages/jquery.validationEngine-en.js"
    charset="utf-8">script>
<script type="text/javascript" src="http://cdn.ucb.org.br/Scripts/formValidator/js/jquery.validationEngine.js"
    charset="utf-8">script>
<script type="text/javascript">
    $(function () {
        //Attach the validate class to each RadioButton.
        $("table[id*=rbYesNo]").validationEngine('attach', { promptPosition: "topRight" });
        $("table[id*=rbYesNo] input").addClass("validate[required]");
        $("[id*=Button1]").bind("click", function () {
            if (!$("table[id*=rbYesNo]").validationEngine('validate')) {
                return false;
            }
            return true;
        });
    });
script>
<form id="form1" runat="server" style="padding-left: 100px">
    Please select one option?
    <br />
    <br />
    <asp:RadioButtonList ID="rbYesNo" runat="server" RepeatDirection="Horizontal">
        <asp:ListItem Text="Yes" Value="1" />
        <asp:ListItem Text="No" Value="2" />
    asp:RadioButtonList>
    <asp:Button ID="Button1" Text="Submit" runat="server" />
form>
 
Validate ASP.Net RadioButtonList using jQuery ValidationEngine Plugin
 
Demo
 
 
Downloads