?
Solved

asp Google Map

Posted on 2017-03-10
2
Medium Priority
?
149 Views
Last Modified: 2017-03-20
hi
i have created a web form frm_map.aspx structured as below:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Frm_Map.aspx.vb" Inherits="Frm_Map" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Google Maps Example</title>
     <script type="text/javascript"
        src="http://www.google.com/jsapi?key=AIzaSyDtWpEfoVxSKPTzKKFmYq1RP-isfqWLFGA"></script>
     <script type="text/javascript">
         google.load("maps", "2");
         // Call this function when the page has been loaded
         function initialize() {
             var map = new google.maps.Map2(document.getElementById("map"));
             map.setCenter(new google.maps.LatLng("<%=lat%>", "<%=lon%>"), 5);
        var point = new GPoint("<%=lon%>", "<%=lat%>");
          var marker = new GMarker(point);
          map.addOverlay(marker);
          map.addControl(new GLargeMapControl());
      }
      google.setOnLoadCallback(initialize);
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div id="map" style="width: 400px; height: 400px"></div>
    </div>
    </form>
</body>

Open in new window


below is it code behind :
Imports System.Data
Imports System.Net

Partial Class Frm_Map
    Inherits System.Web.UI.Page
    Protected lat As String, lon As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim ipaddress As String
        ipaddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
        If ipaddress = "" OrElse ipaddress Is Nothing Then
            ipaddress = Request.ServerVariables("REMOTE_ADDR")
        End If
       
        lat = "33.55"
        lon = "55.45"
       
    End Sub

    
End Class

Open in new window


after running this form i am getting the below error message
his page didn't load Google Maps correctly. See the JavaScript console for technical details.

below is the attach erroe
0
Comment
Question by:pamela rizk
1 Comment
 
LVL 54

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 42048832
as the Javascript Console, it mentioned:

"Control is no longer supported in the Google Maps Javascript API v2. Please visit https://developers.google.com/maps/documentation/javascript/v2/v2tov3 to migrate your application to v3."  maps:163:35
"Map.addControl is no longer supported in the Google Maps Javascript API v2. Please visit https://developers.google.com/maps/documentation/javascript/v2/v2tov3 to migrate your application to v3."  maps:163:35

so, you need to use Google Maps API ver 3 instead. Find out more from:
https://developers.google.com/maps/documentation/javascript/v2/v2tov3
0

Featured Post

A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Loops Section Overview
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question