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

Prevent Searching Radcombobox Templates in Autocomplete

2 Answers 82 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 21 May 2013, 01:20 PM
I recently upgraded to 2013 controls from 2010. I have a radcombobox with template content. Previously, if I typed in the search box, it would search company name only. But now it searches all text, even that in the itemtemplate (such as address etc.). It is now slower, and searches text that I am not interested in searching. Can you please tell me how to search only the DataTextField and not the itemTemplate content? Thanks in advance.

<telerik:RadComboBox ID="RadComboBoxGoThroughPublisher" Runat="server"
                                            AllowCustomText="True" AutoPostBack="False" CollapseDelay="0"
                                            DataSourceID="DataSourceAllPublishers" DataTextField="Company"
                                            DataValueField="PublisherID" EnableItemCaching="True" ExpandDelay="0"
                                            Filter="Contains" HighlightTemplatedItems="True" MarkFirstMatch="True"
                                            MaxHeight="300px"
                                            SelectedValue='<%# myHelperObject.helperGetLicenseThroughPublisherID(Eval("LicenseThroughPublisherID")) %>'
                                            TabIndex="8" Width="340px">
                                            <ItemTemplate>
                                                <span>
                                                <hr />
                                                </span>
                                                <asp:Label ID="LabelCompanyShort" runat="server" CssClass="blueHyperlink"
                                                    Text='<%# Eval("CompanyShort") %>'></asp:Label>
                                                <br />
                                                <span>
                                                <asp:Label ID="LabelCompany" runat="server" CssClass="blueHyperlink"
                                                    Text='<%# Eval("Company") %>'></asp:Label>
                                                </span>
                                                <br />
                                                <span>
                                                <asp:Label ID="lblAddress" runat="server" Text='<%# Eval("Address") %>'></asp:Label>
                                                <br />
                                                <asp:Label ID="lblCityStateZip" runat="server"
                                                    Text='<%# myHelperObject.helperGetFormattedCityStateZip(Eval("City"),Eval("State"),Eval("ZipCode"),1,1,0) %>'></asp:Label>
                                                <asp:Panel ID="PanelPartner" runat="server"
                                                    Visible='<%# myHelperObject.helperGetCheckBoxTrueFalse(Eval("Active")) %>'>
                                                    <div style="padding: 3px">
                                                        <span>
                                                        <asp:Label ID="LabelPartner" runat="server" CssClass="mediumBoldDarkAquaHeader"
                                                            Text="Partner"
                                                            Visible='<%# myHelperObject.helperGetCheckBoxTrueFalse(Eval("Active")) %>'></asp:Label>
                                                         <asp:Label ID="LabelPartnerSynch" runat="server"
                                                            CssClass="mediumBoldDarkAquaHeader" Text="- Synch Allowed"
                                                            Visible='<%# myHelperObject.helperGetCheckBoxTrueFalse(Eval("SynchronizationAllowed")) %>'></asp:Label>
                                                        </span>
                                                    </div>
                                                </asp:Panel>
                                                </span>
                                            </ItemTemplate>
                                        </telerik:RadComboBox>

2 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 24 May 2013, 12:49 PM
Hello,

I would like to clarify the RadComboBox filtering ( searching) functionality works for the text values of the items. Here you may watch a video that shows our online MultiColumn RadComboBox demo with the latest official RadControls release version ( 2013.1.417). It filters only by the text values of the items - in this case that is the contact name. When you try to filter by city name - for sample purposes "Berlin" - it returns zero results. 


Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Mark
Top achievements
Rank 1
answered on 28 May 2013, 01:14 PM
I received the following solution from Telerik in my support ticket. Posting it here for reference. The solution is to put this javascript at the bottom of the .aspx page containing the radcombobox you want to affect:

<script type="text/javascript">
    Telerik.Web.UI.RadComboBoxItem.prototype._highlight = function (regex, element) {
        var item = this,
            matchIsFound = false;
            text = item.get_text();
  
        if (regex.test(text))
            matchIsFound = true;
  
        return matchIsFound;
    }
</script>
Tags
ComboBox
Asked by
Mark
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Mark
Top achievements
Rank 1
Share this question
or