Ich arbeite mit Google Map Multi-Markierungen in asp.net, hier muss ich einen Array-Wert von der Serverseite zur Clientseite Variable senden. Ich verwende "ClientScript.RegisterArrayDeclaration", um das Array an meine clientseitige Variable zu übergeben. Aber es funktioniert nicht. Bitte hilf mir. Ich muss beim Laden der Seite Wert übergeben. "Locations" ist mein Java-Script Variable *Ich arbeite mit Google Map Multi-Markierungen in asp.net
<html>
<head>
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?key=My KEy" type="text/javascript"></script>
</head>
<body>
<center>
<div id="map" style="height: 500px; width: 700px;">
</div>
</center>
<script type="text/javascript">
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 8,
center: new google.maps.LatLng(9.918648010, 78.12000),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
</script>
</body>
</html>
*
protected void Page_Load(object sender, EventArgs e)
{
List<String> oGeocodeList = new List<String>
{
" ['Bala', 9.91864810526, 78.1203081843780, 4] ",
" ['ganesh', 9.91864, 78.12, 5] ",
" ['santhosh', 9.9186, 78.120, 3] ",
" ['test', 9.9186481, 78.12030, 2] ",
" ['test2', 9.918670, 78.12840, 1] "
};
var geocodevalues = string.Join(",", oGeocodeList.ToArray());
ClientScript.RegisterArrayDeclaration("locations", geocodevalues);
}