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

RadComboBox Filtering on item.value as well as item.text

3 Answers 239 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 23 Jan 2014, 03:07 PM
Hi all, real quick question here, is it at all possible some how to allow the filter / markfirstmatched stuff to filter the list on the item.value as well as the text but only display the text element..?

Basically, we have a list of establishments and the value for each establishment is it's site id, some people would love to just type in the 4 digit site id instead of the full name of the site (old school people who are fast with the number pad...) and so it'd be really good if I could specifiy what the items get filtered on?

If I can't filter on both the text and value, could I atleast change to filtering to point at the item.tooltip as I have added both the Text and Value into the tooltip...

Thanks in advance!!!

Adam.

3 Answers, 1 is accepted

Sort by
0
Accepted
Jon
Top achievements
Rank 1
answered on 23 Jan 2014, 06:47 PM
You could make the combo box multi-column (via a template) putting the id in one column and the name in the other.  Then mark first match should work for you.  We do this with Client Name and Client ID.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 24 Jan 2014, 11:53 AM
Hi Adam,

Please have a look into the sample code snippet as suggested by Jon.

ASPX:
<telerik:RadComboBox runat="server" ID="RadComboBox2" Height="190px" Width="420px"
    EmptyMessage="Select" DataTextField="Cityname" DataValueField="Countryname" DataSourceID="SqlDataSource1"
    AutoPostBack="true" AllowCustomText="true" Filter="StartsWith">
    <HeaderTemplate>
        <ul>
            <li class="col1">City Name</li>
            <li class="col2">Country Name</li>
        </ul>
    </HeaderTemplate>
    <ItemTemplate>
        <ul>
            <li class="col1">
                <%# DataBinder.Eval(Container.DataItem, "Cityname")%></li>
            <li class="col2">
                <%# DataBinder.Eval(Container.DataItem, "Countryname")%></li>
        </ul>
    </ItemTemplate>
</telerik:RadComboBox>

Thanks,
Shinu.
0
Adam
Top achievements
Rank 1
answered on 28 Jan 2014, 09:36 AM
Spot on! :) I set the display of the ID column to none also so it still looks the same, but has the hidden additional data :)

Thanks so much! :)
Tags
ComboBox
Asked by
Adam
Top achievements
Rank 1
Answers by
Jon
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Adam
Top achievements
Rank 1
Share this question
or