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

MarkFirstMatch and what is displayed to user

1 Answer 87 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
dhuss
Top achievements
Rank 1
dhuss asked on 22 Apr 2014, 05:58 PM
I have a multi-column combobox that the user wants an ID to show in the box but be able to search on a name using the MarkFirstMatch. What I have noticed is the MarkFirstMatch works on the item.text when the databound event fires. If I set the ID to the text property then you can't search by name. If I set the name to the text property you can search by name but it will not display the ID. Is there anyway to get around this. I have tried the OnItemsRequested but the users don't like the list to get shortned, they just want the hi-light to go to the rows as they type.

telerik:RadComboBox ID="radCBTaxonomy" runat="server" AllowCustomText="true" HighlightTemplatedItems="true"
    DropDownWidth="350px" Width="125px" MaxHeight="200px" OnClientKeyPressing="ChangeToUpperCase" MarkFirstMatch="true"
    OnClientLoad="ChangeToUpperCase" AutoPostBack="true">
    <HeaderTemplate>
        <table style="width: 300px; text-align: left; font-size: 8pt">
            <tr>
                <td style="width: 100px;">
                    Taxonomy Code
                </td>
                <td style="width: 200px;">
                    Name
                </td>
            </tr>
        </table>
    </HeaderTemplate>
    <ItemTemplate>
        <table style="width: 300px; text-align: left; font-size: 8pt">
            <tr>
                <td style="width: 100px; text-transform: uppercase;">
                    <%#DataBinder.Eval(Container.DataItem, "Taxonomy")%>
                </td>
                <td style="width: 200px; text-transform: uppercase;">
                    <%# DataBinder.Eval(Container.DataItem, "ProvName")%>
                </td>
            </tr>
        </table>
    </ItemTemplate>
</telerik:RadComboBox>

ItemDatabound event
e.Item.Text = (DirectCast(e.Item.DataItem, DataRowView))("ProvName").ToString.ToUpper()
e.Item.Value = (DirectCast(e.Item.DataItem, DataRowView))("Taxonomy").ToString.ToUpper()

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 23 Apr 2014, 03:44 AM
Hi dhuss,

RadComboBox supports automatic completion of the text typed in the input area. The text is completed to the match, which is found among the items from the Items collection of the control. This behavior of RadComboBox is enabled/disabled by the MarkFirstMatch property which takes Boolean for a value. The MarkFirstMatch property will check with the Text property of the RadComboBox. In your scenario if you set the ID as the Text property then it will match only with the ID of the Item and in DropDownBox it will highlight that particular item and in the input area it will only show the ID. This is the expected behavior of the control.

Let me know if you have any concern.
Thanks,
Shinu.
Tags
ComboBox
Asked by
dhuss
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or