4
I have a collection of coordinates to popular the Peater, with city name, latitude and longitude.
.aspx
<form id="form1" runat="server">
<div id="repetidor">
var markers = [
<asp:Repeater ID="rptMarkers" runat="server" Visible="true">
<ItemTemplate>
cidade: <%# Eval("NomeCidade")%>,
lat: <%# String.Format(System.Globalization.CultureInfo.GetCultureInfo("en-US"), "{0:D}", Eval("Latitute")) %>,
lng: <%# String.Format(System.Globalization.CultureInfo.GetCultureInfo("en-US"), "{0:D}", Eval("Longitude")) %>,
</ItemTemplate>
<SeparatorTemplate>
-
</SeparatorTemplate>
</asp:Repeater>
]
</div>
I’ll get the coordinates like this;
.aspx.cs
(...)
var address = coordenadas.NomeCidade + ", Brasil";
var locationService = new GoogleLocationService();
var point = locationService.GetLatLongFromAddress(address);
coordenadas.Latitude = point.Latitude;
coordenadas.Longitude = point.Longitude;
coordenadasColecao.Add(coordenadas);
(...)
rptMarkers.DataSource = coordenadasColecao;
rptMarkers.DataBind();
(...)
I’d like it to come out like this: 46.1475292 instead of 46.1475292
Is latitude a variable? Why are you using Eval? Could you give an example that we can reproduce?
– Guilherme Nascimento
yes, a variable. I populate a Repeater with a collection of coordinates.
– Daniel
And the example, where? I asked 3 questions, you only answered 1 and 2, put a clearer example of the code so that we can reproduce to understand your need and can give suggestions that really work how to solve.
– Guilherme Nascimento
yes, I posted the code I’m using.
– Daniel
What value is passing in this part
Eval("Latitute")
?– Randrade
the latitude with the comma.
– Daniel