This is a migrated thread and some comments may be shown as answers.

hideDropDown doesn't work

1 Answer 42 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Amanda
Top achievements
Rank 1
Amanda asked on 26 Aug 2008, 04:02 PM
Hello,

I have a two forms which are using similar code to load the contents of two RadComboBoxes based on what is selected in a third RadComboBox - one is a regular web form, the other is an edit popup within a RadGrid.  I can load the items into the child drop-downs without problems, but the drop-downs are being opened automatically on load, which is confusing - they are close together, so they end up overlapping each other, and the bottom drop-downs items cover up the drop-down above it. 

So, I want to keep those two drop-downs closed when they are loaded.  I have tried calling combobox.hideDropDown() but it generates a javascript error - Invalid Argument. 

Here is a sample of my client-side code - I copied most of it from one of your demos, at http://demos.telerik.com/ASPNET/Prometheus/ComboBox/Examples/Functionality/MultipleComboBoxes/DefaultCS.aspx.

Can you give any advice?

function LoadTimeZonesAndStates(combo, eventarqs)  
    {      
        var countriesCombo = combo;      
        var tzCombo = $find('<%= TimeZoneComboBox.ClientID %>');  
        var stateCombo = $find('<%= StateComboBox.ClientID %>');  
        var item = eventarqs.get_item();  
        tzCombo.set_text("Loading...");  
        stateCombo.set_text("Loading...");  
                  
        if (item.get_index() > 0)  
        {          
            tzCombo.requestItems(item.get_value(), false);  
            stateCombo.requestItems(item.get_value(), false);  
            stateCombo.enable();  
            tzCombo.enable();  
            tzCombo.hideDropDown();  
            stateCombo.hideDropDown();  
        }  
        else 
        {  
            tzCombo.set_text(" ");  
            tzCombo.clearItems();  
            stateCombo.set_text(" ");  
            stateCombo.clearItems();  
        }  
    } 

1 Answer, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 27 Aug 2008, 07:03 AM
Hello Amanda,

I suggest you hook on the OnClientItemsRequested event of the StateComboBox and then execute the following javascript:
function OnClientItemsRequested (sender,e)  
{  
  if(sender.get_dropDownVisible())  
  {  
     sender.hideDropDown()  
 
  }  

Also you can remove  stateCombo.hideDropDown();  line from the LoadTimeZonesAndStates method.

Kind regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Amanda
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Share this question
or