Use google map in application

This resource explains as how to use the GoogleMap API in Asp.Net webforms. I have developed a User control for this so that the GoogleMap can be easily integrated with the Asp.Net.By using this you can integrate the Google map and use different methods like getdirection, Traffic signals etc. Learn how to use Google map in application

How to use Google map in application

I have developed a user control which contains the Google map related stuffs. So that you can easily integrate the GoolgeMap API in your Asp.Net application without much strain.
Follow the below steps to use this

  1. Download the GoogleMap APIzip file.

  2. Paste the AppCode folder and the usercontrol, asmx and js files in your application.

  3. Now in a webform design view drag the GoogleMapIntegration.ascx usercontrol.You won't be able to see Google Map in design view. Instead, you should see Script Manager as part of this control.

  4. At this point you can run your application and you should be able to see a blank Google Map on your page when you run the application.

Passing Parameters to GoogleMap
You must specify Google Map API Key for this component. You can obtain this key from

if (!IsPostBack)
GoogleMapIntegration.GoogleMapObject.APIKey = "";
GoogleMapIntegration.GoogleMapObject.Width = "800px";
GoogleMapIntegration.GoogleMapObject.Height = "600px";
GoogleMapIntegration.GoogleMapObject.CenterPoint= new GooglePoint("CenterPoint", 43.66619, -79.44268);
GoogleMapIntegration.GoogleMapObject.Points.Add(new GooglePoint("1", 40.65669, -78.45278));
GoogleMapIntegration.GoogleMapObject.Points.Add(new GooglePoint("1", 47.65669, -75.45278));
GoogleMapIntegration.GoogleMapObject.ShowTraffic = true;
GoogleMapIntegration.GoogleMapObject.Directions.ShowDirectionInstructions= true;

You can also use to get direction between addresses as

GoogleMapIntegration.GoogleMapObject.Directions.ShowDirectionInstructions = chkShowDirections.Checked;
GoogleMapIntegration.GoogleMapObject.Directions.HideMarkers = chkHideMarkers.Checked;
GoogleMapIntegration.GoogleMapObject.Directions.PolylineColor = txtDirColor.Text;
GoogleMapIntegration.GoogleMapObject.Directions.PolylineWeight = int.Parse(txtDirWidth.Text);
GoogleMapIntegration.GoogleMapObject.Directions.PolylineOpacity = double.Parse(txtDirOpacity.Text);
//Provide addresses or postal codes in following lines

So by this user control you can use the above methods to point the google map.

You can also change the image of the Mapper.

Hope this helps!!!

Application Engineer,
Steadfast technologies


Author: SonyShiva10 Nov 2011 Member Level: Gold   Points : 0

Hi Rajeshwari,

Please check and update your post once.
In this post,Content Posted repeatedly and
Where is the Zip file?

Author: Rajeswari10 Nov 2011 Member Level: Silver   Points : 0

Hi Sony,
The contents are not repeated.I have checked it
Also Click on the attachments to view the zip file. I have attached the zip file.

Steadfast technology

Guest Author: selvi28 Nov 2011

Hi Rajeshwari !Please check your coding thoroughly. I used it. But it does not work. It generates an compilation error.
Line 25: using System.Web.Services;
Line 26: using System.Web.Services.Protocols;
ERROR: Line 27: using System.Web.Script.Services;

Guest Author: 28 Nov 2011

Useful One .Thanks

Author: Rajeswari28 Nov 2011 Member Level: Silver   Points : 0

U r welcome!!!

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: