Click here to Skip to main content
13,001,454 members (58,503 online)
Rate this:
Please Sign up or sign in to vote.
See more:
How to Check any value of RadioButtonList
document.getElementById("<%=rblTitle.ClientID %>").selected = document.getElementById("<%= hfTITLE.ClientID %>").value;

<asp:RadioButtonList ID="rblTitle" runat="server" RepeatDirection="Horizontal">
                                   <asp:ListItem Text="Mr" Value="Mr"></asp:ListItem>
                                   <asp:ListItem Text="Mrs" Value="Mrs"></asp:ListItem>
                                   <asp:ListItem Text="Ms" Value="Ms"></asp:ListItem>

How to select or check by javascript
Posted 4-Feb-13 22:06pm
Tadit Dash 5-Feb-13 4:10am
You need to get the selected radio's value, right?
For example - if I select "Mr.", then you want the value "Mr." using javaScript.
If I am wrong, then correct me.
Member-515487 5-Feb-13 4:11am
yes can u suggest how?
Tadit Dash 6-Feb-13 5:43am
Please check my answer.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I would suggest you to go for jQuery, in which it is be very simple.

Steps to execute any jQuery code
1. Download the jQuery file from Official Website[^].
2. Place inside your project and include in your html (inside head section) like below.
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>

Solution for the asked question
The code provided by you for RadioButtonList will be rendered in browser like below.
<table id="rblTitle">
                <input type="radio" value="Mr" name="rblTitle" id="rblTitle_0">
                <label for="rblTitle_0">Mr</label>
                <input type="radio" value="Mrs" name="rblTitle" id="rblTitle_1">
                <label for="rblTitle_1">Mrs</label>
                <input type="radio" value="Ms" name="rblTitle" id="rblTitle_2">
                <label for="rblTitle_2">Ms</label>

Now you have to work on this code in client-side using jQuery.

So, to get the selected value of radio button, use the below javaScript code in your page.
<script type="text/javascript">
     $(document).ready(function () {
         // Get the Radio Buttons.
         var rblTitle = $('#rblTitle').find('input:radio');
  () {
             // Get the selected value

The selected value will be shown in an alert.

Selected value of RadioButton inside RadioButtonList[^].

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try this
document.getElementById('yourRadioButtonId').checked = true;

Hope this help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 5 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100