I need litte direction with how to do it: I'm saving inside HiddenField values and after that I'm using JSON.parse to:
[Object { LocationID=102, LocationName="9 47 Hall Street", LocationLat="40.69631", more...}, Object { LocationID=13, LocationName="9090 Wilshire Blvd", LocationLat="34.0667", more...}, Object { LocationID=12, LocationName="9150 Wilshire-Palm Building", LocationLat="34.0669", more...}, 129 more...]
the thing is I want to loop over the json and get the values like that
LocationLat = "40.69631"
LocationLng" = -73.96648"
and after that I want so send the value to GoogleMap JS Function
function getValueFromList() {
var jsonString = $get('<%= hfLocationList.ClientID %>').value;
var json = JSON.parse(jsonString);
for (i in json) {
var key = i;
var val = json[i];
}
}
function initialize() {
var myLatlng = new google.maps.LatLng(34.052055, -118.460490);//sending the value to here
var mapOptions = {
zoom: 20,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
});
// To add the marker to the map, call setMap();
marker.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
************************VB Code*****************
Public Sub GetLocationInfo()
Dim LocationList As New List(Of LocationInfo)
Dim dba As New DBAccess
Dim ds As DataSet = dba.GetUserLocationsByID(m_User.UserID, m_User.UserID, m_User.CompanyCode)
Dim dt As DataTable = ds.Tables(0)
For Each dr As DataRow In dt.Rows()
Dim locationInfo As New LocationInfo
locationInfo.LocationName = dr("LocationName")
locationInfo.LocationLat = dr("Lat")
locationInfo.LocationLng = dr("lng")
locationInfo.LocationID = dr("LocationID")
LocationList.Add(locationInfo)
Next
Dim oSerilzer As New System.Web.Script.Serialization.JavaScriptSerializer
Dim sJson As String = oSerilzer.Serialize(LocationList)
hfLocationList.Value = sJson.ToString()
End Sub