I have 2 DropDownList.first DropDownList has 4 options.Second DropDownList has 20 options.I want when an option with value = 1 selected in first DropDownList I show All Element in second DropDownList.and if an option with value = 2 selected in first DropDownList I show some of second DropDownList options and So on. How I can do this using jQuery
Edit 1)
Code is :
<div>
<asp:DropDownList ID="DropDownList1" runat="server" Height="72px" Width="184px">
<asp:ListItem Value="1">All</asp:ListItem>
<asp:ListItem Value="2">Apples</asp:ListItem>
<asp:ListItem Value="2">Orange</asp:ListItem>
<asp:ListItem Value="3">Onion</asp:ListItem>
</asp:DropDownList>
<br />
<asp:DropDownList ID="DropDownList2" runat="server" Height="18px" Width="187px">
<asp:ListItem Value="Apple_Style_1">Apple Style 1</asp:ListItem>
<asp:ListItem Value="Apple_Style_2">Apple Style 2</asp:ListItem>
<asp:ListItem Value="Apple_Style_3">Apple Style 3</asp:ListItem>
<asp:ListItem Value="Orange_Style_1">Orange Style 1</asp:ListItem>
<asp:ListItem Value="Orange_Style_2">Orange Style 2</asp:ListItem>
<asp:ListItem Value="Orange_Style_3">Orange Style 3</asp:ListItem>
<asp:ListItem Value="Orange_Style_4">Orange Style 4</asp:ListItem>
<asp:ListItem Value="Onion_Style_1">Onion Style 1</asp:ListItem>
<asp:ListItem Value="Onion_Style_2">Onion Style 2</asp:ListItem>
</asp:DropDownList>
</div>
You can try this jsFiddle: http://jsfiddle.net/Chran/1/
HTML
JavaScript
You will have to change the Id, according to the ASP.Net Control Id.
Hope this helps you.