Modify the search query on the AutocompleteBox

10 posts, 0 answers
  1. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 12 Nov 2012 Link to this post

    Hello,

    In the autocompletBox , we search in the "DataTextField" which represent the column,

    is it possible to take the query and modify this, to search on the other column ?


    I want to search in City table, i must to search Zip code or City Name in the same AutocompleteBox.

    Please
    Have you a solution ?

    thanks
    Olivier,


  2. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 12 Nov 2012 Link to this post

    Hello olivier,

    In general modifying the search query of the RadAutoCompleteBox is not a supported scenario.

    How do you populate the RadAutoCompleteBox with data?
    Could you please paste here some code to illustrate your implementation?

    Regards,
    Kalina
    the Telerik team
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 12 Nov 2012 Link to this post

    Hello

    I populate with Strataframe Business Object similar to  RadODataDataSource

    If i have name and last name ?

    john smith
    eddy white

    i want to search "john" or "eddy" or "smith" or "white"

    I make in my query  : select name+' '+lastname from MyTable , but my filter StartWidth and i don't search on "smith" or "White".

    in french :
    Cp   = Zip Code
    ville =  City Name

    I want to search on this Column

     <SFWeb:WebBusinessBindingSource runat="server" ID="WbAffaires" BusinessObjectName="oAffairesBo"></SFWeb:WebBusinessBindingSource>
                                <telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1" Width="340" DataSourceID="WbAffaires" Filter="StartsWith" CssClass="RadAutoCompleteBox_Default"
                                DropDownWidth="300px" DataTextField="ville" DataValueField="cp" InputType="Token" Delimiter="," EmptyMessage="Ville, CP ou département." AllowCustomEntry="False">
                                </telerik:RadAutoCompleteBox>


    thanks
    Olivier,
  5. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 12 Nov 2012 Link to this post

    Hi olivier,

    I am afraid that databining the RadAutoCompleteBox via Stataframe Business Object is not a supported scenario.

    Regards,
    Kalina
    the Telerik team
    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.
  6. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 12 Nov 2012 Link to this post

    it's not a problem cause it's work,

    Have you a sample with other datasource to search a value in two or third column ?

    And do you confirm me , with the datasource of your choice, that we can search in other column  of the datasource ?

    thanks
    Olivier,

  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Nov 2012 Link to this post

    Hi Olivier,

    You can search the value in two columns in a table using SqlDataSource as follows.

    ASPX:
    <asp:SqlDataSource ID="SqlDataSource1" runat ="server" ConnectionString ="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT City AS data FROM Customers UNION SELECT ZipCode AS data FROM Customers">
    </asp:SqlDataSource>
    <telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1"  DataSourceID="SqlDataSource1" DataTextField="data" AutoPostBack="true" Filter="StartsWith">
    </telerik:RadAutoCompleteBox >

    Hope this helps.

    Thanks,
    Princy.
  8. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 14 Nov 2012 Link to this post

    Hello Princy

    Great idea, why i don't think about this way.
    it's simple and i can implement with Strataframe Business Object so.

    Thanks You very much.
    Olivier,
  9. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 14 Nov 2012 Link to this post

    Princy,

    Excuse me , but your solution it's a good way,

    In the Autocomplete , i want to display the concatenation between the city and zip code.

    Example :
    ___________________________________________________
    | Display  in the Autocomplete     |      search in the union query   |
    | Los Angeles (90001)                 |      Los Angeles or 90001        |
    | Paris (75001)                             |      Paris or 75001                  |
    ----------------------------------------------------------------------------------

    If you have Idea.
    Olivier,
  10. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Nov 2012 Link to this post

    Hi Olivier,

    Try Modifying your code as follows to achieve your scenario.

    ASPX:
    <asp:SqlDataSource ID="SqlDataSource3" runat ="server" ConnectionString ="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT City+' ('+PostalCode+')' AS data FROM Customers">
    </asp:SqlDataSource>
    <telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1"  DataSourceID="SqlDataSource3" DataTextField="data" AutoPostBack="true" Filter="Contains">
    </telerik:RadAutoCompleteBox >

    Hope this helps.

    Thanks,
    Princy.
  11. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 15 Nov 2012 Link to this post

    Thanks Princy

    it's definitively so bad, cause i must to have Filter "StartsWith" not "Contains"

    May be telerik will add functionnality in the future.

    http://www.telerik.com/community/forums/aspnet-ajax/autocompletebox/add-functionnality-autocompletebox-search-in-multi-column.aspx

    Thanks for all,
    Olivier
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017