Using the JavaScript serializer to send data to JavaScript:
var jsSerializer = new JavaScriptSerializer();
var result = (from c in dt.AsEnumerable()
select new
{
Latitude = c.Field<Decimal>("Latitude"),
Longitude = c.Field<Decimal>("Longitude")
}).ToList();
hdnControl.Value = jsSerializer.Serialize(result);
This will give you values like this:
[
{"Latitude":19.2094000000,"Longitude":73.0939000000},
{"Latitude":19.2244070000,"Longitude":73.1545760000},
{"Latitude":32.5838493257,"Longitude":132.3632812500},
{"Latitude":59.3331894266,"Longitude":8.6572265625}
]
To retrieve these values in a JavaScript function, you can use built-in methods or the .split()
function if needed.
If you need assistance, feel free to ask for help!