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

Problem with Related ComboBox using Filter property

2 Answers 123 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 12 Dec 2010, 07:32 AM
Hello,

I have a related RadComboBox demo like this link. It works fine.

However, I try to add Filter property for RadCombobox Country (Filter="Contains"), I have a problem.

I select an item of RadComboBox Continent then at first mouse click on RadComboBox Country, the item list of RadCombobox Country is shown as empty but the items count of RadComboBox Country > 0. I leave out of RadCombobox Country and then I click on RadCombobox Country again, the item list is shown as full.

Would be grateful for any ideas to show the item list of RadComboBox Country at first click.  Thank you.

Sorry my English.

Here is my code:

<telerik:RadComboBox ID="RadComboBox1"
                runat="server"
                Width="186px"
                CssClass="ComboBox_Continents"
                Filter="Contains"
                OnClientSelectedIndexChanging="LoadCountries"
                OnItemsRequested="RadComboBox1_ItemsRequested" />


<telerik:RadComboBox ID="RadComboBox2"
                runat="server"
                Width="186px"
                CssClass="ComboBox_Countries"
                Filter="Contains"
                OnClientItemsRequested="ItemsLoaded"
                OnItemsRequested="RadComboBox2_ItemsRequested" />

2 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 12 Dec 2010, 04:58 PM
Hello Sam,

This is a bug when using manual Load On Demand and the filtering mechanism, which is a very rare case. 

As we are going to address it in the future, as a workaround, please modify the ItemsLoaded function in the way shown below:

function ItemsLoaded(combo, eventArqs)
    if(combo.get_items().get_count() > 0)
    {
        // pre-select the first item
        combo.set_text(combo.get_items().getItem(0).get_text());
        combo._filterText = combo.get_text(); // OR = "";
        combo.get_items().getItem(0).highlight();
    }
    combo.showDropDown();
}


This will filter the Items after they load with the text in the input, which is that of the first Item, and only it will show in the drop down. If you want to show *all* Items in this case, set the _filterText property to empty string.

Finally the drop down resizing glitch you see in the first case is a bug, which we also know and will fix in the future. You can work it around by setting a specific height to that RadComboBox.

I hope this helps.

Greetings,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Sam
Top achievements
Rank 1
answered on 15 Dec 2010, 07:48 AM
Hello Simon,

It works fine. Thanks for your response.
Tags
ComboBox
Asked by
Sam
Top achievements
Rank 1
Answers by
Simon
Telerik team
Sam
Top achievements
Rank 1
Share this question
or