Combox performance auto complete and combo in textbox mode

11 posts, 0 answers
  1. khurram
    khurram avatar
    13 posts
    Member since:
    May 2008

    Posted 05 Sep 2008 Link to this post

    Hi,

    I am using combox which is loaded via webservice on demand. I am noticing that its very slow. From the moment i type something in a combo till it reaches webservice at server there is a delay of around 3 seconds. Even the "Loading.." text is not shown rapidly. 

    Here is the code:

    <telerik:RadComboBox ID="radList" Runat="server" EnableEmbeddedSkins="False" Skin="search" Width="120px" NoWrap="True" Height="200px" DropDownWidth="225px" EnableLoadOnDemand="true" 
    OnClientItemsRequesting="OnClientItemsRequesting" ItemRequestTimeout="2000"   
    OnClientSelectedIndexChanged="onChanged"   
    EnableViewState="false" LoadingMessage="Loading..." EmptyMessage="Type to get results" 
    >   
     
    <WebServiceSettings Method="GetItems" Path="~/WebServices/Search.asmx" />   
    </telerik:RadComboBox> 
     


    And the javascript function called:

    function OnClientItemsRequesting(sender, eventArgs)  
     
    {   
     
     
    var text = eventArgs.get_text();   
     
    if( text.length < 3)   
     
    {   
     
    eventArgs.set_cancel(true);   
     
    }  
     
    else{   
     
    var context = eventArgs.get_context();  
     
    context["FilterString"] = text;   
     
    }  
    }

    This is the only thing that I do for defining the conotrol. Is there any way to improve the perfomance, as 3  seconds just to get to server is really slow.

    My second question is there a way to change mode of combo to textbox?

    Thanks in advance for your help.

    Best regards,

    Khurram

  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 08 Sep 2008 Link to this post

    Hello khurram,

    It is really strange that you get such a delay. Do you experience the same problem in our online demo?

    Can you explain in more detail what do you mean by "to change mode of combo to textbox" ?


    All the best,
    Veskoni
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. khurram
    khurram avatar
    13 posts
    Member since:
    May 2008

    Posted 08 Sep 2008 Link to this post

    Hi,
    thanks for your reply. I have checked your demo online and its working fine. I will try to investigate more what could be causing it.

    As far as textbox mode is concerned; I had liked to display a combo list as a textbox so that the user cannot open it and has to type to get the list. Something like ajax toolkit autocomplete but with text, value selection.

    http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx

    Regards,
    Khurram
  4. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 11 Sep 2008 Link to this post

    Hello khurram,

    To hide the dropdown image you can set the ShowToggleImage property to False.
    To open the dropdown only when the user types a number of letters please see this article:
    Requesting items when a given number of letters are entered


    Sincerely yours,
    Veskoni
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. khurram
    khurram avatar
    13 posts
    Member since:
    May 2008

    Posted 24 Sep 2008 Link to this post

    Hi,
    I finally found what cas causing the delay. If you set timeout request value it adds a considerable delay.
    Regards,
    Khurram
  6. rtk
    rtk avatar
    46 posts
    Member since:
    Aug 2006

    Posted 23 Oct 2008 Link to this post

    Is it possible to not show the dropdownlist before i have enter a number of letters.

    This only prevent filling the dropdownlist before 3 letters are typed in.

    function OnClientItemsRequestingHandler(sender, eventArgs)
    {
       if (sender.get_text().length < 3)
       {
           
    eventArgs.set_cancel(true);
       }

    I would like it to look just like a textbox, until i have enter 3 letters. Maybe i should use another methods?
  7. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 23 Oct 2008 Link to this post

    Hi brajoh,

    You can use the same method to cancel the OnClientDropDownOpening event.

    I hope this helps.

    All the best,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. rtk
    rtk avatar
    46 posts
    Member since:
    Aug 2006

    Posted 24 Oct 2008 Link to this post

    Thaks, now i just need to clear the dropdownlist on clientside. If the number of letters get smaller than 3, i need to clear and hide the dropdownlist.

    And is it possible to insert a row on clientside and make this selected.
  9. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 24 Oct 2008 Link to this post

    Hi brajoh,

    For the first questions - you can subscribe to the OnClientKeyPressing event and hide the dropdown using the client-side API of the combobox.

    And yes, it is possible to add a new item in the combobox client-side. Please check this demo:
    Add/Remove/Disable items

    Sincerely yours,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  10. mark baer
    mark baer avatar
    142 posts
    Member since:
    Sep 2009

    Posted 20 Mar 2013 Link to this post

    If a request is taking a long time, is there a way to cancel it clientside?  Does it need to be done server side?  Is there a way you recommend we handle this?

    thanks
  11. Nencho
    Admin
    Nencho avatar
    1822 posts

    Posted 25 Mar 2013 Link to this post

    Hello Mark,

    You could achieve this functionality, by canceling the OnClientItemsRequesting client-side event, or handling the OnClientItemsRequestFailed if any error has occurred while loading elements using the load-on-demand mechanism.

    All the best,
    Nencho
    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.
Back to Top