Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
How do you get the coordinates from razor?
Thanks
Eric
Hi Eric
You should be able to access the maps property like you would access any other value using Razor.
In order to get extract the coordinates and zoom level you should be able to do something like this:
@{ var map = @Model.map; var lat = map.Split(',')[0]; var lng = map.Split(',')[1]; var zoom = map.Split(',')[2]; }<p>@map</p><p>@lat</p><p>@lng</p><p>@zoom</p>
Hope this helps you.
/Jan
Thanks Jan. I'm an idiot, I did't click the bubble on the map to choose the location so my values were null.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Retrieving Lat, Long Zoom from Razor
Hi,
How do you get the coordinates from razor?
Thanks
Eric
Hi Eric
You should be able to access the maps property like you would access any other value using Razor.
In order to get extract the coordinates and zoom level you should be able to do something like this:
@{
var map = @Model.map;
var lat = map.Split(',')[0];
var lng = map.Split(',')[1];
var zoom = map.Split(',')[2];
}
<p>@map</p>
<p>@lat</p>
<p>@lng</p>
<p>@zoom</p>
Hope this helps you.
/Jan
Thanks Jan. I'm an idiot, I did't click the bubble on the map to choose the location so my values were null.
Thanks
Eric
is working on a reply...