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

4 posts, 1 answers
  1. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 01 Nov 2010 Link to this post

    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>
  2. Answer
    Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 02 Nov 2010 Link to this post

    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.
  3. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 02 Nov 2010 Link to this post

    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
  4. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 03 Nov 2010 Link to this post

    I upgraded to Q2 2010 v2010.2.929.35 and the FILTER="Contains" is properly working now.

    Thanks for the suggestion Cori! 
Back to Top