Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

set radiobuttonlist with javascript

Posted on 2014-01-17
2
Medium Priority
?
355 Views
Last Modified: 2014-01-17
Hi

I have this radio button list:
 <asp:RadioButtonList ID="rblRefer2Provider" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" ClientIDMode="Static">
 <asp:ListItem Text="No" onclick="toggleRefer2Provider2(false);" />
 <asp:ListItem Text="Yes" onclick="toggleRefer2Provider2(true);" />
</asp:RadioButtonList>

Open in new window


Based on another page event I want to select or de select the first item (The No) using JavaScript (not jquery)

I have tried document.getElementById('rblRefer2Provider_0').checked = true; but this doesn't work, but the radio button list doesn't render as such.

How do I do this. I have searched Google but nothing seems elegant or works.

Andy
0
Comment
Question by:Andy Green
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 39787949
var radioContainer = document.getElementById('<%= rblRefer2Provider.ClientID %>');
var radioButtons = radioContainer.getElementsByTagName("input");
radioButtons[0].checked = true; // No

Open in new window

0
 
LVL 3

Author Closing Comment

by:Andy Green
ID: 39788070
Nice one thanks

Andy
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question