Display Google Map in aspx page using Javascript

No.of Views854
Bookmarked0 times
Downloads 
Votes1
By  dipal   On  15 Feb 2010 23:02:52
Tag : JavaScript , How to
Display Google Map in aspx page using Javascript
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

Now days google map is very popular one. Since now google has given feature to display google map in asp.net pages with few lines of java script code.

In this article have deatils about that.To this create web application using visual studio. it's bring up  with new default.aspx page.

Then within the default.aspx page  design view , make html like  following.

{codecitation class="brush: html; gutter: true;" width="700px"}

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;
key=ABQIAAAAcl" type="text/javascript"></script>

<script language="javascript" type="text/javascript">
function load() {

map = new GMap2(document.getElementById("map"));

map.addControl(new GMapTypeControl());
//Adding the control that allows to see the scale
map.addControl(new GScaleControl());

map.setCenter(new GLatLng(Langitude, latitude), 14); // (Here you can set //your map Center . and 14 is zoom level of Map .)

map.addControl(new GLargeMapControl());

}

</script>

</head>
<body onload="javascript:load();">
<form id="form1" runat="server">
<div id="map">
</div>
</form>
</body>
</html>

{/codecitation}

That's now press F5 and run web it will show the map in page.

Thank you

Patel

 
Sign Up to vote for this article
 
About Author
 
dipal
Occupation-Not Provided
Company-Not Provided
Member Type-Fresh
Location-Not Provided
Joined date-10 Jun 2009
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top