Hi ,
I have a repeater to show the data and has another repeater for google map.My map will show 10 markers .Now i need to highlight the first marker when hovering the first result in the repeater and so on Here is my code...
<div id="dvMap">
</div>
<script type="text/javascript">
//Generate Markers Value Array
var markers = [
<asp:Repeater ID="rptMarkers" runat="server">
<ItemTemplate>
{
"title":'<%# Eval("Company") %>',
"lat": '<%# Eval("Latitude") %>',
"lng": '<%# Eval("Longitude") %>',
"description": '<%# Eval("Company") %></br><%# Eval("StreetAddress") %></br><%# Eval("City") %>-<%# Eval("ZipCode") %></br><%# Eval("StateName") %> '
}
</ItemTemplate>
<SeparatorTemplate>
,
</SeparatorTemplate>
</asp:Repeater>
];
</script>
<script type="text/javascript">
window.onload = function () {
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
var infoWindow = new google.maps.InfoWindow();
for (i = 1; i <= markers.length; i++) {
var letter = String.fromCharCode("A".charCodeAt(0) + i - 1);
var data = markers[i - 1]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title,
icon: "http://maps.google.com/mapfiles/marker" + letter + ".png"
});
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent(data.description);
infoWindow.open(map, marker);
});
})(marker, data);
}
}
</script>
<div class="recent-list" id="side-bar">
Here i am binding repeater control
</div>
My Code behind file
PagedDataSource pageds = new PagedDataSource();
pageds.DataSource = dt.DefaultView;
pageds.AllowPaging = true;
pageds.PageSize = 10;
rptMarkers.DataSource = pageds;
rptMarkers.DataBind();
How to achieve my task...