CODEDIGEST
Home Articles CodeDigest Tutorials FAQs
Home > CodeDigest >  
Technologies
 


Get Selected RadioButtonList value in ASP.Net Using Jquery
Submitted By Satheesh Babu B
On 12/15/2008 5:51:30 AM
Tags: asp.net,CodeDigest,JQuery  

Get Selected RadioButtonList value in ASP.Net Using jQuery/JavaScript

 

There may be situations where we may need to fetch the selected or checked value of a Asp.Net RadioButtonList control in javascript for doing some validations. I will use jQuery library in this small article to demonstrate this.

If you are new to jQuery then i will advise to take a look into the below link to understand it quickly.

What is jQuery? How to use it in ASP.Net Pages?

How to enable jQuery intellisense in Visual Studio 2008?

How to use jQuery intellisense in an external javascript file?


The following code snippet will help us to get the selected radio button value using jQuery.

 

<script language="javascript">

        $(document).ready(function() {

            $("#btnSubmit").click(function() {

                alert($("#RadioButtonList1").find("input[@checked]").val());

            });

        });

    </script>

 

<asp:RadioButtonList ID="RadioButtonList1" runat="server">

        <asp:ListItem>1</asp:ListItem>

        <asp:ListItem>2</asp:ListItem>

        <asp:ListItem>3</asp:ListItem>

    </asp:RadioButtonList>

     <input id="btnSubmit" type="button" value="Submit" />

Recent Codes
  • View All Codes..