How do I get a horizontally oriented radiobuttonlist to make a dropdownlist visible or hidden using javascript?

My tools:  Visual Web Developer, backcoding

This script works fine at the outset, but whenever I change the radiobuttonlist to 'horizontal' orientation within Visual Web Developer 'properties' the script does not work. If I change it back, then it still doesn't work. Can anyone give me a method to do this using a 'horizontally' oriented two-option radiobuttonlist rather than this vertical orientation?


<html xmlns="" >
<head id="Head1" runat="server">
<script language="javascript">
//hide the dropdownlist on pageload...
function function_StartHidden()
     document.getElementById("myddl").style.display = "none";


window.onload= function_StartHidden;


<script type="text/javascript">
//show the dropdownlist...
function ShowDropDown()
     document.getElementById("myddl").style.display = "inline";
////hide the dropdownlist
function HideDropDown()
     document.getElementById("myddl").style.display = "none";
    <form id="form1" runat="server">
        Choose 'pn1' to make the dropdownlist visible; choose 'pn2' to hide the dropdownlist.....<br />
        <br />
        <asp:DropDownList ID="myddl" runat="server" Width="88px">
            <asp:ListItem>item 1</asp:ListItem>
            <asp:ListItem>item 2</asp:ListItem>
            <asp:ListItem>item 3</asp:ListItem>
            <asp:ListItem>item 4</asp:ListItem>
        </asp:DropDownList>&nbsp;<br />
        <br />
        Here we have a radiobuttonlist:<br />
        <asp:radiobuttonlist runat="Server" id="rbl">
        <asp:listitem onclick="ShowDropDown()">pn1</asp:listitem>
        <asp:listitem onclick="HideDropDown()">pn2</asp:listitem>
        <br />

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add the RepeatDirection="Horizontal" attribute in the code as follows:

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

This will help you display Radiobutton list in horizontal direction

Chirag Patel

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jazjefAuthor Commented:

Thanks.... that works great!

Can you explain to me why changing the radiobuttonlist orientation to 'horizontal' within the 'properties' section of the design area does not work, but adding RepeatDirection="Horizontal" directly into the html  of the control does work?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.