Link to home
Start Free TrialLog in
Avatar of MoreThanDoubled
MoreThanDoubled

asked on

Get value from combo box

Hi all,

I am not sure why this is not working but i have two combo boxes.
When i select a value from the 1st combo box i would like the second combo to get populated based on what is in the 1st combo box.

the problem that i am having is that i cannot get the value from the first combo box when i click on the second combo box.

I tried using the FindControl function to get the value but its not working.
I am using C# , VS 2010

Any suggestions?


Thanks
Avatar of mankowitz
mankowitz
Flag of United States of America image

Are you using ASP.NET? if so, you want a cascading drop down list. See this article: http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
or is just like this one:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox2.SelectedItem = comboBox1.SelectedItem;
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox1.SelectedItem = comboBox2.SelectedItem;
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of pkbugudai
pkbugudai
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial