Zip code search by radius and price

2 posts, 0 answers
  1. Michael
    Michael avatar
    6 posts
    Member since:
    Dec 2016

    Posted 08 Mar 2018 Link to this post

    I have a readgrid with a list of USA addresses.

     

    I want to be able to enter in a city, state or zip code and have it show me the list with what is closest first to what was entered.

    What API would I want to connect with?  

     

    Also, has anybody had any experience with taking this one step further and not just look at what is closest but factor in other items like price example.

     

    Facility A is 10 miles away and our cost is $50

    Facility B is 11 miles away and our cost is $40

     

    Even thought A is closed I want B to show first since its only 1 mile away but we will save $10 by telling the person searching this is the first pick.

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4836 posts

    Posted 13 Mar 2018 Link to this post

    Hi,

    I can suggest you start from the following demo that shows how you can filter the grid data source based on an external control. It uses a combo box and a declarative SqlDataSource with a ControlParameter. Link: https://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridcomboajax/defaultcs.aspx?product=combobox&show-source=true.

    Alternatively, you can provide data to the grid in its NeedDataSource event which can be triggered by a call to its .Rebind() method. This, in turn, can be called by an event like TextChanged of the input textbox. This will let you execute any logic you need in order to provide the desired grid data source. You can read more about using the NeedDataSource event here: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-binding/understanding-data-binding/server-side-binding/advanced-data-binding-(using-needdatasource-event).


    Regards,
    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top