Click here to Skip to main content
15,849,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my database i have latitude and longitude saved in table . i need to fetch all lat n long from database n show marks based on the coordinates on google map .i found some article but it shows one marker at a time n it's from client side. can anyone help me out here. as English is not my first language sorry for any grammatical and spelling mistake
i found some code to do this.
<html xmlns="">
<head  runat="server">
    <script src=""
    <form id="form1"  runat="server">
    <div id="map" style="width: 500px; height: 400px;"></div>
    <script type="text/javascript">
        var locations = [['Bondi Beach', -33.890542, 151.274856], ['Coogee Beach', -33.923036, 151.259052], ['Cronulla Beach', -34.028249, 151.157507], ['Manly Beach', -33.800128, 151.282085], ['Maroubra Beach', -33.950198, 151.259302]];
        var map = new GMap2(document.getElementById('map'));
        var i; map.setCenter(new GLatLng(-33.92, 151.25), 10);
        for (i = 0; i < locations.length; i++) 
            var marker = new GMarker(new GLatLng(locations[i][1], locations[i][2]));
            GEvent.addListener(marker, "click", function ()

but this is not show multiple infowindow . and tell how i can fetch lat n long from database on
Updated 27-Feb-12 20:56pm
Anuja Pawar Indore 28-Feb-12 1:56am    
Added code block

Share this answer
Uday P.Singh 28-Feb-12 2:14am    
Anuja Pawar Indore 28-Feb-12 2:16am    
Thanks Uday
you have to use the Google Maps API, which is in fact just a set of JavaScript functions. You just have to pass the coordinates stores somewhere in the database from server-side to JavaScript. Here is the code:

<script type="text/javascript">
        var map;
        function initialize() {
            if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
                var lat = <asp:literal id="ltrLat" runat="server" xmlns:asp="#unknown" />;
                var lng = <asp:literal id="ltrLng" runat="server" xmlns:asp="#unknown" />;
                var center = new GLatLng(lat, lng);
                map.setCenter(center, 10);
                var marker = new GMarker(center);
Share this answer
kishore sharma 27-Feb-12 23:47pm    
Hello,continue to above script
you can also use in this way
var lat =<%=strParam %>;
where strParam Is code behind variable of public access.
to which you can assing value from database & it can be used in javascript of your map.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900