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

ComboBox Filter doesn't work

3 Answers 74 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 04 Jun 2011, 12:32 AM
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

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Jun 2011, 06:47 AM
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.
0
Nick
Top achievements
Rank 1
answered on 06 Jun 2011, 05:36 PM
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
0
Shinu
Top achievements
Rank 2
answered on 07 Jun 2011, 05:37 AM
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.
Tags
ComboBox
Asked by
Nick
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Nick
Top achievements
Rank 1
Share this question
or