I'm developing in an Asp.net C # project and I'm not sure how to get a list of strings from my class on the page.
How do I get these values?
Code that I've used.
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>