Googlemap control for Asp.Net MVC

Places search box


About this example

This sample shows how to use googlemap api libraries features througt this control even when they are not totally supported by the control in a "pure mvc way".

You just need to add the library you want to use

    @(Html.GoogleMap()
        .Name("map")
        .Height(500)
        .Libraries(new [] {"places"})
        .ClientEvents(events => events.OnMapLoaded("mapEvent"))
    )

And then using the map event OnMapLoaded you can get a reference to the map and accomplish your task using javascript. See the view tab for more details

The places search box allows users to perform a text-based geographic search, such as 'pizza in New York' or 'shoe stores near robson street'. You can attach the SearchBox to a text field and, as text is entered, the service will return predictions in the form of a drop-down pick list.

See Places search box in Google Developers for more options.