?
Solved

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

Posted on 2007-07-25
2
Medium Priority
?
1,452 Views
Last Modified: 2013-11-26
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>
0
Comment
Question by:jazjef
2 Comments
 
LVL 9

Accepted Solution

by:
Chirag1211 earned 2000 total points
ID: 19572153
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
 
LVL 4

Author Comment

by:jazjef
ID: 19574653
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
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
Course of the Month16 days, 4 hours left to enroll

850 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