Click here to Skip to main content
15,126,209 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I am dealing with a HTML-Javascript web page. Here I have 3 combo boxes as:
<table><tbody><tr><td><select id="prod1"  runat="server"/></td></tr></tbody></table>
<table><tbody><tr><td><select id="prod2"  runat="server"/></td></tr></tbody></table>
<table><tbody><tr><td><select id="prod3"  runat="server"/></td></tr></tbody></table>


These combo boxes are populated by an SQL statement which returns 2 products:
Table Fan
Exhaust Fan

Now the requirement is if I select Table Fan in prod1, prod2 combo box should only show me Exhaist Fan so eventually prod3 should not offer me any value. With ASP.Net controls its easy to do but the requirement is in javascript. Please help.

Thanking you in advance.

IB
Posted
Updated 30-Mar-11 2:48am
v2

1 solution

maybe this help ? :

C#
function AddItem(Text,Value)
    {
        // Create an Option object
        var opt = document.createElement("option");
        // Add an Option object to Drop Down/List Box
        document.getElementById("DropDownList").options.add(opt);
        // Assign text and value to Option object
        opt.text = Text;
        opt.value = Value;
    }
   
Comments
Indrojeet_Bhattacharya 30-Mar-11 8:33am
   
Thank you sir !

Well partially it will help but how to manage the display of discriminated values through SQL.

IB
Piccadilly Yum Yum 30-Mar-11 8:59am
   
this is a complete example : http://forums.asp.net/t/1155780.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900