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

Purely client-side load on demand (no DB or web service) and autocomplete?

2 Answers 48 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
KN425000
Top achievements
Rank 1
KN425000 asked on 21 Jul 2011, 09:53 PM
Is it possible to populate a combo box purely on the client, without any SqlDataSource or web service call?

For example, I have a list box with two RadCombBox objects in the ItemTemplate.   The first combo box is called "Type" and contains two hard-coded values ("Fruit" and "Color").   The second combo box is called "Values" and it needs to both support autocomplete and load on demand of only values appropriate for the selected value in the first box.  The possible values for the second box is a small, well-defined list that won't change often, so I don't want to incur a call to the database.

So, if the user selects "Fruit" from the first box, and then starts to type into the second box, I only want to show the user the fruit values (apple, banana, orange, and so on) that match their filter. (E.g., if they type "or" then I should only show "orange.")

On the other hand, if the user selects "Color" from the first combobox, and then starts typing into the second box, I only want to show the user the color values (red, green, blue, etc.) that match their filter. (E.g., if they type "re" then I should only show "red".)

I see from the docs how to do this with a DB or web service call;  the question is could I do this against a fixed list in the client page, or by binding to the results of some JavaScript method, or by using some kind of prefix in the items list of the second box, so I don't have to call out over the wire to a data server?


Thanks

2 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 25 Jul 2011, 03:48 PM
Hello Kn425000,

The RadComboBox doesn't support client-side binding. Since in your scenario you will be working with small amount of items you could add new items and remove the existing ones using the client-side API as shown on these help articles here and here.

Best wishes,
Dimitar Terziev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
KN425000
Top achievements
Rank 1
answered on 25 Jul 2011, 06:51 PM
Yeah, I figured that.

So far, in order to solve the problem, I created a little JSON array client-side and then have been using LINQ.js to parse it and populate the RadComboBox controls.

Thanks
Tags
ComboBox
Asked by
KN425000
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
KN425000
Top achievements
Rank 1
Share this question
or