Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all,
Iam trying to use below code but showing this above problem.Please,help me to find out the solution.On page load,I have added a method name that is ConvertDataTabletoString() and iam trying to call the method...This code I have taken from below links

http://www.aspdotnet-suresh.com/2013/05/aspnet-show-multiple-markers-on-google.html[^]
var markers = JSON.parse('<%=ConvertDataTabletoString() %>');\\ error here

<script type="text/javascript">
function initialize() {
var markers = JSON.parse('<%=ConvertDataTabletoString() %>');\\ error here
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
// marker:true
};
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
for (i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title
});
(function (marker, data) {

// Attaching a click event to the current marker
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent(data.description);
infoWindow.open(map, marker);
});
})(marker, data);
}
}
google.setOnLoadCallback(initialize);
</script>
Posted
Comments
[no name] 7-Apr-14 8:21am    
Did you ask Suresh about his code? Did you copy all of the code from Suresh's website? Did you actually read his article? How would you expect us to answer this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900