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

Possible to filter AutomaticLoadOnDemand, multicolumn RadComboBox based off of a all columns?

3 Answers 130 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Casey
Top achievements
Rank 1
Casey asked on 01 Nov 2010, 06:52 PM
Hello,

I was wondering if it is possible to have a multicolumn RadComboBox being loaded using AutomaticLoadOnDemand and have the items filtered in the RadComboBox based on what the users type, but not limit the search to be against only the DataValueField of the RadComboBox. I'd like the below RadComboBox to be filtered by CUST_ID, COMPANY_NAME, CONTACT_NAME and ADDRESS when the user types anything in the RadComboBox's text area.

Here is my RadComboBox that I am interested in adding this functionality to.

Please let me know if this is possible.

<telerik:RadComboBox ID="rcbCust" runat="server" CausesValidation="false"
               EnableAutomaticLoadOnDemand="true" Width="550px"
               AutoPostBack="true" DataTextField="COMPANY_NAME"
               DataSourceID="ObjectDataSource1"
               OnSelectedIndexChanged="rcbCust_SelectedIndexChanged"
               AllowCustomText="true"
               EmptyMessage="Select a customer to enter an order for "
               EnableAjaxSkinRendering="true"
               DataValueField="CUST_ID" >
                    <HeaderTemplate>
                        <table width="100%">
                            <tr>
                                <td style="width: 115px" align="center">
                                    Customer ID
                                </td>
                                <td style="width: 115px" align="center">
                                    Company Name
                                </td>
                                <td style="width: 115px" align="center">
                                    Contact Name
                                </td>
                                <td style="width: 120px" align="center">
                                    Address
                                </td>
                            </tr>
                        </table>
    </HeaderTemplate>
    <ItemTemplate>
        <table width="100%">
            <tr>
                 <td style="width: 115px" align="center">
                      <%# DataBinder.Eval(Container.DataItem, "CUST_ID") %>
                 </td>
                 <td style="width: 115px" align="center">
                      <%# DataBinder.Eval(Container.DataItem, "COMPANY_NAME") %>
                 </td>
                 <td style="width: 115px" align="center">
                      <%# DataBinder.Eval(Container.DataItem, "CONTACT_NAME") %>
                 </td>
                 <td style="width: 120px" align="center">
                      <%# DataBinder.Eval(Container.DataItem, "ADDRESS") %>
                 </td>
            </tr>
        </table>
    </ItemTemplate>                                                                         
</telerik:RadComboBox>

3 Answers, 1 is accepted

Sort by
0
Accepted
Cori
Top achievements
Rank 2
answered on 02 Nov 2010, 01:30 PM
Hello Casey,

If you want to use AutomaticLoadOnDemand, I would suggest creating a column  that combines all the fields, separated by spaces, into one and set it as the DataValueField. Then set Filter="Contains", so it searches for the text within that string. Otherwise, I would suggest handling the LoadOnDemand yourself, by turning LoadOnDemand on and handling the ItemsRequested event yourself. That way you can keep the DataValueField how you have it, but have the search look at all the columns.

I hope that helps.
0
Casey
Top achievements
Rank 1
answered on 02 Nov 2010, 03:53 PM
Cori,

Thanks for the soltuion. I think that is the right solution; however, I am using Q1 2010 controls at the moment and I believe the below is stopping that solution from working.  Also, it appears to filter against the DataTextField and not the DataValueField. Is there a way to filter against the value in the DataValueField instead??

Thanks,
Casey

Filter "contains" does not work
0
Casey
Top achievements
Rank 1
answered on 03 Nov 2010, 02:13 PM
I upgraded to Q2 2010 v2010.2.929.35 and the FILTER="Contains" is properly working now.

Thanks for the suggestion Cori! 
Tags
ComboBox
Asked by
Casey
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Casey
Top achievements
Rank 1
Share this question
or