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

My tools:  Visual Web Developer, VB.net 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?

Thanks.....


<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Jscript_VB.NET_TOOLS</title>
   
<script language="javascript">
/////////////////////////////////////////////////////////////////
//hide the dropdownlist on pageload...
function function_StartHidden()
{
     document.getElementById("myddl").style.display = "none";

}    

window.onload= function_StartHidden;

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</script>

<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";
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</script>
   
</head>
<body>
    <form id="form1" runat="server">
    <div>
        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>
        </asp:radiobuttonlist>
        <br />

    </div>
    </form>
</body>
</html>
LVL 4
jazjefAsked:
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.

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

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


This will help you display Radiobutton list in horizontal direction
Regards,

Chirag Patel
0

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:
Chirag:

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?

0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.