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

Supress ItemsRequested event on key press

2 Answers 66 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Billy
Top achievements
Rank 2
Billy asked on 13 Jul 2010, 04:50 PM

I am loading a rad combo box on demand (EnableLoadOnDemand="True") in the ItemsRequested event. I want this to load when the user opens the combo box but not when they type in the combo box (I have MarkFirstMatch = true). Is this possible?

Here is the code I am using for all this if it helps:

<telerik:RadComboBox ID="RadComboBox2" CssClass="DGselectPerson" runat="server" EmptyMessage="Select a Person" EnableLoadOnDemand="True" AppendDataBoundItems="false" AutoPostBack="true" DataTextField="Name" DataValueField="RecordID" EnableVirtualScrolling="true" OnClientDropDownOpening="onDropDownOpening" OnItemsRequested="RadComboBox2_ItemsRequested" MarkFirstMatch="true">

 

 

 

 

</telerik:RadComboBox>

 

Protected

 

 

Sub RadComboBox2_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles RadComboBox2.ItemsRequested

 

RadComboBox2.DataSource = GetPeople()

RadComboBox2.DataBind()

 

 

End Sub

 

2 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 14 Jul 2010, 01:24 PM
Hello Billy Hasan,

You can achieve this in a different way:
  • Set EnableLoadOnDemand to false.
  • Handle the client-side DropDownOpening event in this way:
    function onDropDownOpening(sender) {
        if (sender.get_items().get_count() == 0)
            sender.requestItems("", false);
    }
Everything else in your implementation can remain the same.

I hope this helps.

Kind regards,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Billy
Top achievements
Rank 2
answered on 14 Jul 2010, 02:03 PM
That worked, thank you! However SelectedIndexChanged is no longer firing when I select an item from the list.
Tags
ComboBox
Asked by
Billy
Top achievements
Rank 2
Answers by
Simon
Telerik team
Billy
Top achievements
Rank 2
Share this question
or