Solved

asp Google Map

Posted on 2017-03-10
2
56 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
2 Comments
 
LVL 51

Accepted Solution

by:
Ryan Chong earned 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

763 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