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

Combox performance auto complete and combo in textbox mode

10 Answers 176 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
khurram
Top achievements
Rank 1
khurram asked on 05 Sep 2008, 09:22 PM
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

10 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 08 Sep 2008, 12:38 PM
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.
0
khurram
Top achievements
Rank 1
answered on 08 Sep 2008, 04:06 PM
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
0
Veselin Vasilev
Telerik team
answered on 11 Sep 2008, 01:59 PM
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.
0
khurram
Top achievements
Rank 1
answered on 24 Sep 2008, 02:29 PM
Hi,
I finally found what cas causing the delay. If you set timeout request value it adds a considerable delay.
Regards,
Khurram
0
rtk
Top achievements
Rank 1
answered on 23 Oct 2008, 03:17 PM
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?
0
Veselin Vasilev
Telerik team
answered on 23 Oct 2008, 03:28 PM
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.
0
rtk
Top achievements
Rank 1
answered on 24 Oct 2008, 08:18 AM
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.
0
Veselin Vasilev
Telerik team
answered on 24 Oct 2008, 02:53 PM
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.
0
mark baer
Top achievements
Rank 1
answered on 20 Mar 2013, 06:36 PM
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
0
Nencho
Telerik team
answered on 25 Mar 2013, 11:08 AM
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.
Tags
ComboBox
Asked by
khurram
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
khurram
Top achievements
Rank 1
rtk
Top achievements
Rank 1
mark baer
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or