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

3 posts, 0 answers
  1. KN425000
    KN425000 avatar
    16 posts
    Member since:
    Aug 2010

    Posted 21 Jul 2011 Link to this post

    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. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 25 Jul 2011 Link to this post

    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!

  3. KN425000
    KN425000 avatar
    16 posts
    Member since:
    Aug 2010

    Posted 25 Jul 2011 Link to this post

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