Abort Previous Requests on Keypress

4 posts, 0 answers
  1. Abisanka
    Abisanka avatar
    2 posts
    Member since:
    Nov 2013

    Posted 25 Nov 2013 Link to this post

    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
  2. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 27 Nov 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Abisanka
    Abisanka avatar
    2 posts
    Member since:
    Nov 2013

    Posted 28 Nov 2013 Link to this post

    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
  5. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 03 Dec 2013 Link to this post

    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.
Back to Top