7
I am developing in an Asp.net C# project and I don’t know how to get on the page a list of strings of my class.
How do I get these values?
Code I’ve been using.
var pontos= rota.ObterCordenadas(this._gvConsultaCheck, txtDtInicial, txtHoraInicial, txtDtFinal, txtHoraFinal, serial);
List<string> latitudes = new List<string>();
List<string> longitudes = new List<string>();
foreach (var item in pontos)
{
char delimiterChars = ',';
string[] coord = item.Split(delimiterChars);
latitudes.Add(coord[0]);
longitudes.Add(coord[1]);
}
this._HdLatitudes.Value = (new JavaScriptSerializer()).Serialize(latitudes);
this._HdLongitudes.Value = (new JavaScriptSerializer()).Serialize(longitudes);
<html>
<input id="_HdLatitudes" type="hidden" value="" runat="server" />
<input id="_HdLongitudes" type="hidden" value="" runat="server" />
</html>
<script>
var latitudes = $("#_HdLatitudes").val();
var longitudes = $("#_HdLongitudes").val();
<script>
You’ve heard of Ajax?
– Marconi
as it would be in ajax?
– Hans Miller
This is possible with Ajax and Json.
– Arthur Menezes