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

Abort Previous Requests on Keypress

3 Answers 166 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
Abisanka
Top achievements
Rank 1
Abisanka asked on 25 Nov 2013, 07:09 AM
Hi,

I have a query regarding Rad search box. Suppose I'm typing "SCOTT" in the search area. In the firebug console I found 5 different requests to the server. What I need to know is while typing continuously, how can I make the searchbox abort "s", "sc", "sco", "scot" requests and accept only "scott" as the search term so that the server is hit only once and not 5 times.

I have used Ajaxcontroltoolkit autocomplete before which has the same functionality of aborting requests. How can I achieve the same for rad search box. Any idea?

Thanks
Abi

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 27 Nov 2013, 09:07 AM
Hello,

One possible way to achieve similar behavior is to cancel the OnClientDataRequesting event according to your custom scenario or to set the MinFilterLength property to 5 if you want to search all the time after the 5th character.

Regards,
Plamen
Telerik
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 the blog feed now.
0
Abisanka
Top achievements
Rank 1
answered on 28 Nov 2013, 06:54 AM
Hello Plamen,

In the client event that you suggested, how do I ignore the all keypresses and accept the last keypress and text only?

Unfortunately I cannot set minimum filter length to 5, it has to be 1 in my application scenario.

Regards
Abi
0
Plamen
Telerik team
answered on 03 Dec 2013, 06:31 AM
Hi,

Let me elaborate a little bit - the onClientRequesting event is thrown on every letter that is typed and you can cancel the request only according the text that is already typed. Unfortunately there is no way to prevent the request unless you can check it at that point in the event and cancel it.

Hope this information will be helpful.

Regards,
Plamen
Telerik
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 the blog feed now.
Tags
SearchBox
Asked by
Abisanka
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Abisanka
Top achievements
Rank 1
Share this question
or