-2
所以我设法标记和信息窗口使用剃刀和谷歌地图API做干活如下:只显示最后一个标记信息的窗口,即使有154人
@{
IEnumerable<UFA.Location.Core.Location> Location = UFALocation___Front.Helpers.QueryHelper.QueryHelper.getAllLocations();
foreach(var loc in Location){
<text>
var [email protected] = "@loc.name";
[email protected] = new google.maps.Marker({
position: new google.maps.LatLng(@loc.latitude, @loc.longitude),
map: map,
title: "Hello World!"
});
var infoWindow = new google.maps.InfoWindow({
content: [email protected]
});
google.maps.event.addListener([email protected], 'click', function() {
infoWindow.open(map, [email protected]);
});
</text>
}
}
更新
所以它显示为每个位置的信息框,因为我想但其中的内容只是最后一个位置的名称,而不考虑位置。实质上,信息框并不与任何一个特定的位置绑定,即使我已经为每个ID创建了所有的信息,如果这是有道理的。
可能重复(http://stackoverflow.com/questions/3059044/google-maps-js-api-v3-simple-multiple-marker-示例) – 2013-05-09 20:19:12