aspx pages:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="googlemap.aspx.cs" Inherits="AmbitSite_googlemap" %>
<!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 id="Head1" runat="server">
<title></title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script language="javascript" type="text/javascript">
var count = 0;
var map;
var geocoder;
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
var count = 0;
var map;
var geocoder;
function InitializeMap() {
directionsDisplay = new google.maps.DirectionsRenderer();
var latlng = new google.maps.LatLng(21.7679, 78.8718); //21.7679, 78.8718
var myOptions =
{
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
};
map = new google.maps.Map(document.getElementById("map"), myOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById('directionpanel'));
}
function markicons(lat, lng,address) {
InitializeMap();
var ltlng = [];
//alert(lat + "\n" + lng);
ltlng.push(new google.maps.LatLng(lat, lng));
map.setCenter(ltlng[0]);
for (var i = 0; i <= ltlng.length; i++) {
marker = new google.maps.Marker({
map: map,
position: ltlng[i]
});
(function (i, marker) {
infowindow = new google.maps.InfoWindow();
infowindow.setContent(address);
infowindow.open(map, marker);
google.maps.event.addListener(marker, 'click', function () {
infowindow = new google.maps.InfoWindow();
infowindow.setContent(address);
infowindow.open(map, marker);
});
})(i, marker);
}
}
// window.onload = markicons;
</script>
</head>
<body >
<form id="form1" runat="server">
<div>
<div style="float: left;">
</div>
<div style="float: left;">
<table>
<tr>
<td style="width: 627px">
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
<div id="map" style="height: 581px">
</div>
</td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
code cs pages:-
using System;
using System.Data;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
public partial class AmbitSite_googlemap : System.Web.UI.Page
{
static string baseUri = "http://maps.googleapis.com/maps/api/geocode/xml?latlng={0},{1}&sensor=false";
string location = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string lat, lng, Address;
lat = "19.000302";//19.000302 19.000302 / 28.601714 77.229145/ 12.983569 77.595707/ 1.282729 103.850573
lng = "19.000302";
Address = "";
if (Request.QueryString["lat"] != null)
{
lat =Request.QueryString["lat"].ToString().Trim();
if (lat == "19.000302")
{
Address = "<b>Ambit Holding</b></br>more info>></br>Ambit House, 449,Senapati Bapat Marg,Lower Parel,</br> Mumbai - 400 013.";
}
else if (lat == "28.601714")
{
Address = "<b>Ambit Holding</b></br>more info>></br>Room No.422,Vivanta by Taj – Ambassador,Sujan Singh Park,Subramania Bharti Marg,</br> New Delhi - 110 003.";
}
else if (lat == "12.983569")
{
Address = "<b>Ambit Holding</b></br>more info>></br>Empire Infantry </br> Unit No. 3, 29 Infantry Road,1st Floor,</br> Bangalore - 560 001.";
}
else if (lat == "1.282729")
{
Address = "<b>Ambit Holding</b></br>more info>></br>#19-03 Equity Plaza ,20 Cecil Street,</br> Singapore - 049 705.";
}
}
if (Request.QueryString["long"] != null)
{
lng = Request.QueryString["long"].ToString().Trim();
}
ClientScript.RegisterStartupScript
(GetType(), "Javascript", "javascript: markicons('" + lat + "','" + lng + "','" + Address + "'); ", true);
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="googlemap.aspx.cs" Inherits="AmbitSite_googlemap" %>
<!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 id="Head1" runat="server">
<title></title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script language="javascript" type="text/javascript">
var count = 0;
var map;
var geocoder;
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
var count = 0;
var map;
var geocoder;
function InitializeMap() {
directionsDisplay = new google.maps.DirectionsRenderer();
var latlng = new google.maps.LatLng(21.7679, 78.8718); //21.7679, 78.8718
var myOptions =
{
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
};
map = new google.maps.Map(document.getElementById("map"), myOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById('directionpanel'));
}
function markicons(lat, lng,address) {
InitializeMap();
var ltlng = [];
//alert(lat + "\n" + lng);
ltlng.push(new google.maps.LatLng(lat, lng));
map.setCenter(ltlng[0]);
for (var i = 0; i <= ltlng.length; i++) {
marker = new google.maps.Marker({
map: map,
position: ltlng[i]
});
(function (i, marker) {
infowindow = new google.maps.InfoWindow();
infowindow.setContent(address);
infowindow.open(map, marker);
google.maps.event.addListener(marker, 'click', function () {
infowindow = new google.maps.InfoWindow();
infowindow.setContent(address);
infowindow.open(map, marker);
});
})(i, marker);
}
}
// window.onload = markicons;
</script>
</head>
<body >
<form id="form1" runat="server">
<div>
<div style="float: left;">
</div>
<div style="float: left;">
<table>
<tr>
<td style="width: 627px">
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
<div id="map" style="height: 581px">
</div>
</td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
code cs pages:-
using System;
using System.Data;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
public partial class AmbitSite_googlemap : System.Web.UI.Page
{
static string baseUri = "http://maps.googleapis.com/maps/api/geocode/xml?latlng={0},{1}&sensor=false";
string location = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string lat, lng, Address;
lat = "19.000302";//19.000302 19.000302 / 28.601714 77.229145/ 12.983569 77.595707/ 1.282729 103.850573
lng = "19.000302";
Address = "";
if (Request.QueryString["lat"] != null)
{
lat =Request.QueryString["lat"].ToString().Trim();
if (lat == "19.000302")
{
Address = "<b>Ambit Holding</b></br>more info>></br>Ambit House, 449,Senapati Bapat Marg,Lower Parel,</br> Mumbai - 400 013.";
}
else if (lat == "28.601714")
{
Address = "<b>Ambit Holding</b></br>more info>></br>Room No.422,Vivanta by Taj – Ambassador,Sujan Singh Park,Subramania Bharti Marg,</br> New Delhi - 110 003.";
}
else if (lat == "12.983569")
{
Address = "<b>Ambit Holding</b></br>more info>></br>Empire Infantry </br> Unit No. 3, 29 Infantry Road,1st Floor,</br> Bangalore - 560 001.";
}
else if (lat == "1.282729")
{
Address = "<b>Ambit Holding</b></br>more info>></br>#19-03 Equity Plaza ,20 Cecil Street,</br> Singapore - 049 705.";
}
}
if (Request.QueryString["long"] != null)
{
lng = Request.QueryString["long"].ToString().Trim();
}
ClientScript.RegisterStartupScript
(GetType(), "Javascript", "javascript: markicons('" + lat + "','" + lng + "','" + Address + "'); ", true);
}
}
}
No comments:
Post a Comment