Click here to Skip to main content
15,913,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two dropdown.
When i select Any value in First dropdown after that i want to open second dropdown automatically is there in solution for that.
Posted
Comments
JoCodes 17-Jan-14 5:03am    
You mean to say , binding second dropdown on selection of first?
Member 10453691 17-Jan-14 5:07am    
no. I have two drop down.with binded. When i select Anyvalue in First Dropdown i want to open second dropdown automatically.
Member 10453691 17-Jan-14 5:17am    
??
KarstenK 17-Jan-14 5:04am    
in which language are you working? Some code is needed...
Member 10453691 17-Jan-14 5:05am    
I working in Asp.net C#

1 solution

Maybe this will help you

 <combobox name="comboBox1">
                    DropDownClosed="comboBox1_DropDownClosed" 
                    SelectionChanged="comboBox1_SelectionChanged" />
And your code behind

    private bool keepOpen = false;
    private void comboBox1_DropDownClosed(object sender, EventArgs e)
    {
        new Thread(() =>
        {
            comboBox1.Dispatcher.Invoke(new Action(() =>
            {
                // do your IF logic here
                if (keepOpen)
                {
                    comboBox1.IsDropDownOpen = true;
                    keepOpen = false;
                }
            }), null);
        }).Start();
    }

    private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        keepOpen = true;
    }</combobox>
 
Share this answer
 
v2

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