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

[Solved] How to: Initially have nothing in the combobox?

1 Answer 175 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Christian McCarrick
Top achievements
Rank 1
Christian McCarrick asked on 28 Dec 2007, 08:46 PM
I am trying to mimic the behavior of sites such as www.kayak.com with their airport selection box.  The way it works is that initially, there is nothing loaded at all in the box and only after supplying at least 3 characters does it fetch the available choices.  I have a database with over 20,000 items that I do not want to be initially loaded or paged.  So for this to work, they have to be able to input custom text in order for any text to be entered at all if the box is not filled at load.  Please advise as to the best way to accomplish this.

Thanks,
Christian

1 Answer, 1 is accepted

Sort by
0
LFA
Top achievements
Rank 1
answered on 30 Dec 2007, 04:26 AM
Set:
ShowDropDownOnTextboxClick=False
AllowCustomText=True
MarkFirstMatch=True
EnableLoadOnDemand=True
ItemRequestTimeout=milliseconds to wait before callback

Handle the ItemsRequested event on the server to bind the filtered results or use a web service.
On the client side use the OnClientItemsRequesting event to cancel the request if the length is less than 3.


Have you looked at the autocomplete control from the ajax control toolkit?
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx

This is an easier solution but if you want more control you will have to do it with the Telerik ComboBox.

With the autocomplete control set:
FirstRowSelected=true
MinimumPrefixLength=3
Configure properties ServicePath and ServiceMethod.
Create a web service that returns the filtered values.
Tags
ComboBox
Asked by
Christian McCarrick
Top achievements
Rank 1
Answers by
LFA
Top achievements
Rank 1
Share this question
or