<script src="Scripts/jquery-1.4.1.js"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=false"> </script> <script src="Scripts/jquery-1.7.1.js"></script> <script type="text/javascript"> var markers = { locationLatitude: "", locationLongitude: "", ComName: "", Introduction: "" }; var markerArray = []; window.onload = function () { var t = self.setTimeout(function () { var size = $('.LocationLabel').length; for (i = 0; i < size; i++) { var GPS = $('.LocationLabel').eq(i).text(); var ComName = $('.Cust_NameLabel').eq(i).text(); var Introduction = $('.DescriptionLabel').eq(i).text(); markers.locationLatitude = GPS.split(',')[0]; markers.locationLongitude = GPS.split(',')[1]; markers.ComName = ComName; markers.Introduction = Introduction; markerArray.push(markers); } var mapOptions = { center: new google.maps.LatLng(markers.locationLatitude, markers.locationLongitude), zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP }; var infoWindow = new google.maps.InfoWindow(); var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions); for (i = 0; i < markerArray.length; i++) { var data = markerArray[i] var myLatlng = new google.maps.LatLng(data.locationLatitude, data.locationLongitude); var marker = new google.maps.Marker({ position: myLatlng, map: map, title: data.ComName }); (function (marker, data) { google.maps.event.addListener(marker, "click", function (e) { infoWindow.setContent(data.Introduction); infoWindow.open(map, marker); }); })(marker, data); } }, 20); } </script> <div id="RepaterConntrol"> <asp:Repeater ID="rptMarkers" runat="server"> <ItemTemplate> <asp:Label ID="lbl_CustName" CssClass="Cust_NameLabel" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "ComName")%>' /> <asp:Label ID="lbl_Location" CssClass="LocationLabel" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "GPS")%>' /> <asp:Label ID="lbl_Description" CssClass="DescriptionLabel" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Introduction")%>' /> </ItemTemplate> <SeparatorTemplate> , </SeparatorTemplate> </asp:Repeater> </div> <div class="panel-body" id="dvMap" style="height:450px;width:450px;"> </div> |