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

LoadOnDemand triggered by enter key

4 Answers 95 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Aaron Gibbs
Top achievements
Rank 2
Aaron Gibbs asked on 25 Jan 2012, 05:19 PM
Good morning,

We are using a RadCombobox within a user control as an employee selector tool.  User types in a few characters of an employee name or number and it auto-populates with matches from our database.

The problem is our database is rather large and depending on the speed of the person typing it is sometimes performing a callback and executing a query which may return way too much data.  For example:

User types "513"
Callback is initiated
ItemsRequested server-side event fires
SQL query executes and begins retrieving 25,000 records containing 513
Meanwhile, user is typing the rest of the employee#, but the server is waiting on SQL

I would like to make sure the ItemsRequested server-side event only fires when the user hits the Enter key after typing, is this possible?

4 Answers, 1 is accepted

Sort by
0
Aaron Gibbs
Top achievements
Rank 2
answered on 27 Jan 2012, 07:25 PM
*bump*  Anyone?
0
Kalina
Telerik team
answered on 30 Jan 2012, 02:23 PM
Hi Aaron,

A new request for items fires when the user types in the input area or clicks on the dropdown toggle image - in case there are no items in the RadComboBox.
I am afraid that firing a request only upon “Enter” key pressing is not a supported scenario.

However you can try using the MinFilterLength property. This property sets the minimum length of the typed text before the control initiates a request for new items.
Please take a look at the “Load On Demand” section in the “ComboBox / Configurator” demo – please choose the “Custom” option there, set some value at the “Minimum filter length” input and observe the RadComboBox behaviour.

All the best,
Kalina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Aaron Gibbs
Top achievements
Rank 2
answered on 30 Jan 2012, 05:58 PM
Thank you for the response.

Is there a way I can mimic this behavior perhaps buy putting a button to trigger populating the dropdown instead?  

I could place a button as the DefaultButton inside a panel containing the RadComboBox and button.  User can type in the RadComboBox and hit Enter, which fires an async postback on the button_Click event.  I can then use the button_click event's server-side code to populate the items collection of the RadComboBox.  Using this method, can I force the RadComboBox to be expanded when the postback completes?
0
Kalina
Telerik team
answered on 02 Feb 2012, 04:43 PM
Hi Aaron,

Load On Demand fires when the user types in the input area or clicks on the drop-down toggle image when there are no items in the RadComboBox.
As I understand – you want to prevent this, and rice a request for items via another control (a button).

I am afraid that changing the Load On Demand behaviour will affect the whole RadComboBox functioning. Maybe you will manage to implement your scenario without Load On Demand?

In order to enable RadComboBox expand its dropdown when loaded – you can set the OpenDropDownOnLoad property to “true”.

Greetings,
Kalina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ComboBox
Asked by
Aaron Gibbs
Top achievements
Rank 2
Answers by
Aaron Gibbs
Top achievements
Rank 2
Kalina
Telerik team
Share this question
or