ComboBox Filter doesn't work

4 posts, 0 answers
  1. Nick
    Nick avatar
    17 posts
    Member since:
    Oct 2010

    Posted 03 Jun 2011 Link to this post

    Hi there,

    I am sure it is something very trivial, but I've spent couple of hours on that already and I think I am missing some obvious thing at that point.

    I am trying to have something similar to next demo: http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/filteringcombo/defaultcs.aspx

    However, filtering just doesn't work at all. Typing in the ComboBox is not doing anything.

    Here is my sample application:
    <telerik:RadScriptManager ID="m1" runat="server"/>
    <telerik:RadComboBox ID="b1" runat="server" AutoPostBack="true"
                    AllowCustomText="true" Filter="Contains"
                    Style="vertical-align: middle;" Width="100px" Label="Filter:">
       <Items>
           <telerik:RadComboBoxItem Text="None" Value="0" />
            <telerik:RadComboBoxItem Text="Contains" Value="1"/>
            <telerik:RadComboBoxItem Text="StartsWith" Value="2" />
       </Items>
    </telerik:RadComboBox>
    As you can see example is very simple and there is literally nothing in there.

    I also tried setting DataTextField to Text or Value. Doesn't matter - still no results.
    I also tried to do DataBind() from server side code to ObservableCollection<string> and Dictionary<string,string> with no results as well.

    Please advise.

    Thanks,
    Nick
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Jun 2011 Link to this post

    Hello Nick,

    Have you set the Filter property of the first combobox based on the selected Item in the second Combo( b1)?
    C#:
    protected void Page_Load(object sender, EventArgs e)
            {
                RadComboBox1.Filter = (RadComboBoxFilter)Convert.ToInt32(b1.SelectedValue);
            }

    Thanks,
    Shinu.
  3. Nick
    Nick avatar
    17 posts
    Member since:
    Oct 2010

    Posted 06 Jun 2011 Link to this post

    Shinu,

    I don't have 2nd ComboBox in my project. Example I showed is all I have in my sample project. I just happened to copy values from the demo site. Just so no one get confused about sample values here is updated still not working sample project:
    <telerik:RadScriptManager ID="m1" runat="server"/>
    <telerik:RadComboBox ID="b1" runat="server" AutoPostBack="true"
                    AllowCustomText="true" Filter="Contains" Width="100px">
       <Items>
           <telerik:RadComboBoxItem Text="Test1"/>
            <telerik:RadComboBoxItem Text="Blah"/>
            <telerik:RadComboBoxItem Text="Foo"/>
       </Items>
    </telerik:RadComboBox>

    That is all I have in the project, I have only omitted <html>,<head>, and <body> tags.

    I also tried setting filter for my comboBox on Page_Load but that didn't help either.

    Thanks,
    Nick
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Jun 2011 Link to this post

    Hello Nick,
    I cannot find any issue with your code and the same code worked as expected at my end.
    Here I am pasting my entire code and and please try it in an independent page.
    aspx:
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <telerik:RadScriptManager ID="m1" runat="server"/>
         <telerik:RadComboBox ID="b1" runat="server" AutoPostBack="true" AllowCustomText="true"
                Filter="Contains" Width="100px">
                <Items>
                    <telerik:RadComboBoxItem Text="Text1" />
                    <telerik:RadComboBoxItem Text="Text2" />
                    <telerik:RadComboBoxItem Text="Text3" />
                </Items>
            </telerik:RadComboBox>
        </div>
        </form>
    </body>
    </html>

    Thanks,
    Shinu.
Back to Top