RadComboBox - Search Any Part Of String

4 posts, 1 answers
  1. Mark
    Mark avatar
    25 posts
    Member since:
    Feb 2012

    Posted 16 Nov 2012 Link to this post

    So, I have a RadComboBox that is populated with a product number and a name (123456 - product name).  I want to be able to type in either the product number ("123456") or the product name and have the auto complete functionality work.

    I know I need to have a client side script "OnClientItemsRequesting"
    I know I can probably use a [WebMethod] - probably using the <WebServiceSettings> within the Telerik RadComboBox....
    I know that I need to populate the data from a database...
    I know that I have to do this for 6 different combo boxes.

    ...but my knowledge and skill set is terrible after that.

    I'm assuming that my client side script will be something like this:
    function OnClientItemsRequesting(sender, eventArgs) {
         var context = eventArgs.get_context();
         context["FilterString"] = eventArgs.get_text();
     }

    My web method should be something like this:
    public RadComboBoxItemData[] GetItem1Values(object context)
            {
                //previously declared global
                DataBaseConnection db = new DataBaseConnection();
     
                IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context;
     
                string filterString = ((string)contextDictionary["FilterString"]).ToLower();
                string filterNext = ((string)contextDictionary["FilterNext"]);
     
                BrandCode = cmbProd1Filter.SelectedItem.Value;
                DataTable dt = db.StoredProcedures.getItemBumbersByBrandCode_Command(QtyUp, BrandCode);
     
                var filterRows = (from dr in dt.AsEnumerable() select dr.Field<string>("ItemName")).ToArray();
     
              //I have no idea what happens after that... I need help
            }

    Any help would be appreciated... I really need it.

    Thanks in advance.
  2. Mark
    Mark avatar
    25 posts
    Member since:
    Feb 2012

    Posted 19 Nov 2012 Link to this post

    Anything? Need some help, here....
  3. Answer
    Cat Cheshire
    Cat Cheshire avatar
    128 posts
    Member since:
    Jun 2010

    Posted 20 Nov 2012 Link to this post

    If you have the filterRows as an array - you can simply loop through this array and create a RadComboBoxItemData objects list to return.
    In this article you can see similar approach:
    http://www.telerik.com/help/aspnet-ajax/combobox-load-on-demand-webservice.html
  4. Mark
    Mark avatar
    25 posts
    Member since:
    Feb 2012

    Posted 20 Nov 2012 Link to this post

    AH!  Thank you!  That's perfect!
Back to Top