How To Pass Value from database to google map( javascript function)

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="Server">
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
 <title>Google Maps JavaScript API Example</title>

 <script src=";v=2&amp;key=ABQIAAAAjQ5pL86XOoQ41VopETg1BxRfqogRWDFFWKC2bFG72235ZrnYERRoUjFELdorAiLMorc8KixeuNcskQ"

 <script type="text/javascript">


 function load() {
   if (GBrowserIsCompatible()) {
   var lat = document.getElementById("lat").value;
   var lon = document.getElementById("lon").value;
   var map = new GMap2(document.getElementById("map"));
   map.setCenter(new GLatLng(lat,lon), 13);


<body onload="load()" onunload="GUnload()">
 <form id="form1" runat="server">
     <div id="map" style="width: 500px; height: 300px">

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

public partial class GoogleMap : System.Web.UI.Page
 protected void Page_Load(object sender, EventArgs e)
 {   string lat = "37.4419";
     string lon = "-122.1419";

     Page.ClientScript.RegisterHiddenField("lat", lat);
     Page.ClientScript.RegisterHiddenField("lon", lon);


Post a Comment


Close Menu