User Control Page /Controls/ViewQuestionsCompletedMap.ascx (C#)
Uses Code Behind Page Page /Controls/ViewQuestionsCompletedMap.ascx.cs (C#)
1: <%@ Control Language="C#" AutoEventWireup="True" Inherits="QuiznetOnline.Web.UI.ViewQuestionsCompletedMap" Codebehind="ViewQuestionsCompletedMap.ascx.cs" %>  
2: <%@ Register Src="~/Controls/GoogleMapForASPNet.ascx" TagName="GoogleMapForASPNet" TagPrefix="uc1" %>  
3:   
4:   
5: <%@ Reference Control="~/Master/MasterPage.master"%>  
6:   
7: <style type="text/css">  
8:       html, body, #map_canvas {  
9:         margin: 0;  
10:         padding: 0;  
11:         height: 100%;  
12:       }  
13:     </style>  
14:   
15:   
16:     <script src="Include/jquery-1.7.2.min.js" type="text/javascript"></script>  
17:     <script src="Include/popup.js" type="text/javascript"></script>  
18:   
19: <!-- In the head section of the page -->  
20:     <script type="text/javascript" src="include/jquery.js"></script>  
21:   
22:     <script type="text/javascript"  
23:         src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>  
24:     <script type="text/javascript">  
25:   
26:         var prm = Sys.WebForms.PageRequestManager.getInstance();  
27:         prm.add_initializeRequest(InitializeRequest);  
28:         prm.add_endRequest(EndRequest);  
29:   
30:         function InitializeRequest(sender, args) {  
31:         }  
32:   
33:         // fires after the partial update of UpdatePanel  
34:         function EndRequest(sender, args) {  
35:             initialize()  
36:         }  
37:   
38:         mapObj = new Object();  
39:         mapObj.latitude = 0;  
40:         mapObj.longitude = 0;  
41:   
42:   
43:         function initialize() {  
44:             //Center of the earth  
45:             var latlng = new google.maps.LatLng(24.324408, 12.216797);  
46:             var myOptions = {  
47:                 zoom: 2,  
48:                 center: latlng,  
49:                 mapTypeId: google.maps.MapTypeId.ROADMAP  
50:             };  
51:             var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);  
52:   
53:             setMarkers(map);  
54:   
55:         }  
56:   
57:   
58:         function setMarkers(map) {  
59:             var logs;  
60:             var hiddenNumberOfRecords = document.getElementById("<%= hiddenNumberOfRecords.ClientID %>");  
61:   
62:             $.ajax({  
63:                 type: "POST",  
64:                 contentType: "application/json; charset=utf-8",  
65:                 url: "WebServices/MapService.asmx/GetLastnMapPositions",  
66:                 data: "{NumberOfRecords:'" + hiddenNumberOfRecords.value + "'}",  
67:                 dataType: "json",  
68:                 success: function (response) {  
69:                     logs = response.d;  
70:   
71:                     for (var i = 0; i < logs.length; i++) {  
72:                         if (logs[i].Location.toLowerCase() != "unknown") {  
73:                             var myLatLng = new google.maps.LatLng(logs[i].Latitude, logs[i].Longitude);  
74:                             var marker = new google.maps.Marker({  
75:                                 position: myLatLng,  
76:                                 map: map  
77:                             });  
78:                         }  
79:                     }  
80:                 },  
81:                 failure: function (msg) {  
82:                     $('#output').text(msg);  
83:                 }  
84:             });  
85:         }  
86:   
87:     </script>  
88:   
89:     <asp:HiddenField runat="server" ID="hiddenNumberOfRecords" />  
90:   
91:     <table style="height:400px">  
92:         <tr>  
93:             <td>  
94:                 <div id="map_canvas" style="width:1000px; height:600px"></div>  
95:             </td>  
96:         </tr>  
97:     </table>  
98:   
99:   

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.