Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating model with latitude and longitude #135

Open
dark-equinox opened this issue Jan 26, 2017 · 2 comments
Open

Updating model with latitude and longitude #135

dark-equinox opened this issue Jan 26, 2017 · 2 comments
Labels

Comments

@dark-equinox
Copy link

Is there a way to update the model with the latitude and longitude from the geocoding service on the view? I am sending address to geocode, displaying on map. I would like to not make two calls to service to get the lat and long and update my form.
@(Html.GoogleMap() .Name("map") .Width(200) .Height(200) .Center(c => c.Address(Model.Street + " " + Model.City + ", " + Model.State)) .Markers(m => m.Add().Title(Model.Street)) .Zoom(13)

I am new to MVC so I appreciate any help you can provide.

@dark-equinox
Copy link
Author

Ok, so after going through all the issues, I can see that you can subscribe to event listeners. What I want to do is get the lat and long from a single marker and on dragend event show the lat and long on the form at dragend to save to database. the example I found was doing it server side, I want to handle this client side.

thanks

@Micnick
Copy link

Micnick commented Aug 8, 2017

Hi, do you have a example, I need update model from my map, and show it, in edit View, but the binding property no load the custom marker

<div style="height:100%; width:100%;"> @{ Html.GoogleMap() .Name("map") .Height(420) .MapTypeId(MapType.Hybrid) .ClientEvents(events => events .OnMapClick("mapClick") .OnMapLoaded("mapLoaded") ) .BindTo<WebApi.Models.RegionInfoModel,Marker> (pinInfo,mappings => mappings.For<WebApi.Models.RegionInfoModel> ( binding => binding.ItemDataBound ( (marker,regionInfo) => { marker.Latitude = regionInfo.Latitude; marker.Longitude = regionInfo.Longitude; marker.Title = regionInfo.Title; marker.ZIndex = regionInfo.ZIndex; marker.Clickable = true; } ) ) ) .Zoom(12) .ApiKey("zzz") .Center(c => c.UseCurrentPosition()) .Render(); } </div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants