Combobox + Checkbox+Load on demand+search Item

2 posts, 0 answers
  1. Murugesh
    Murugesh avatar
    7 posts
    Member since:
    Oct 2013

    Posted 18 Nov 2013 Link to this post

    Hello Sir,

    I have the following requirement  to be implemented on my web page. It is similar to MS Excel 2010 Filter. Attached is the sample.

    1. Multiple selection from the Dropdown using checkbox option.
    2. Have to use web service to load the data ( I have approx. 5000 Items )
    3. Autosuggest, while typing system should show the item to be picked.

    I Just purchased the new Telerik License . I hope it will support my requirements

    Thank you

    Regards,
    Muru

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Nov 2013 Link to this post

    Hi Murugesh,

    Please have a look into the sample code i tried to achieve your scenario.

    ASPX:
    <telerik:RadComboBox runat="server" ID="RadComboBox1" Width="300px" EnableLoadOnDemand="true"
        CheckBoxes="true" OnClientItemsRequesting="OnClientItemsRequesting" Filter="StartsWith">
        <WebServiceSettings Method="GetProducts" Path="Products.asmx" />
    </telerik:RadComboBox>

    JavaScript:
    <script type="text/javascript">
        function OnClientItemsRequesting(sender, eventArgs) {
            var context = eventArgs.get_context();
            context["FilterString"] = eventArgs.get_text();
        }
    </script>

    WebService CS Page(Products.CS):
    [WebMethod]
    public RadComboBoxItemData[] GetProducts(object context)
    {
        IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context;
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
        string filterString = ((string)contextDictionary["FilterString"]).ToLower();
        SqlCommand selectCommand = new SqlCommand(
        @" SELECT * FROM Customers WHERE (CompanyName) LIKE '" + filterString + "%'", connection);
        SqlDataAdapter adapter = new SqlDataAdapter(selectCommand);
        DataTable products = new DataTable();
        adapter.Fill(products);
        List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(products.Rows.Count);
        foreach (DataRow row in products.Rows)
        {
            RadComboBoxItemData itemData = new RadComboBoxItemData();
            itemData.Text = row["CompanyName"].ToString();
            itemData.Value = row["CompanyName"].ToString();
            result.Add(itemData);
        }
        return result.ToArray();
    }


    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top