Get value from combo box

MoreThanDoubled used Ask the Experts™
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?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Are you using ASP.NET? if so, you want a cascading drop down list. See this article:

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


I believe you are doing this thing in datagrid. for that please do this. For 1st dropdown do  this thing.
<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="Name" DataValueField="ID" OnSelectedIndexChanged="Codebehindmethod" AutoPostBack="True" />

create one code behind method like Codebehindmethod(sender, args)

On selectedindex change it will call the "Codebehindmethod" method. do not forget to add autopostback true. In codebehind method find the the second dropdown using find control value. here also you can get the first dropdown selected  value. then use both dropdown for your requirement.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial