Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9206465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:10:53+00:00 2026-06-18T00:10:53+00:00

I have problem in implementing google maps api in asp.net. Here is my aspx

  • 0

I have problem in implementing google maps api in asp.net. Here is my aspx code:

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



<%--A sample project by Ghaffar khan--%>

<!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>Your Data on Google Map </title>
    <%--Google API reference--%>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false
                 &amp;key=asdfg" type="text/javascript">
    </script>
</head>

<body onload="initialize()" onunload="GUnload()">
    <form id="form1" runat="server">
    <asp:Panel ID="Panel1" runat="server">
                <%--Place holder to fill with javascript by server side code--%>
                <asp:Literal ID="js" runat="server"></asp:Literal>
                <%--Place for google to show your MAP--%>
                <div ID="map_canvas" style="width: 100%; height: 728px; margin-bottom:                      2px;">
                </div>
                <br />
            </asp:Panel>
        <br />
   </form>
   </body>

</html>

And my code behind:
getLocation() is the method which gets the longitude and latitude from my database. createDataTable() is method which create DataTable from those locations.

protected void Page_Load(object sender, EventArgs e)
    {
        string user_id;
        user_id = Request.Cookies["cookie"]["Login"];
        getLocation(user_id);
        BuildScript( createDataTable());

    }
    private void BuildScript(DataTable tbl)
    {
        String Locations = "";
        foreach (DataRow r in tbl.Rows)
        {
            // bypass empty rows        
            if (r["Latitude"].ToString().Trim().Length == 0)
                continue;

            string Latitude = r["Latitude"].ToString();
            string Longitude = r["Longitude"].ToString();

            // create a line of JavaScript for marker on map for this record    
            Locations += Environment.NewLine + " map.addOverlay(new GMarker(new GLatLng(" + Latitude + "," + Longitude + ")));";
        }

        // construct the final script
        js.Text = @"<script type='text/javascript'>
                            function initialize() {
                              if (GBrowserIsCompatible()) {
                                var map = new GMap2(document.getElementById('map_canvas'));
                                map.setCenter(new GLatLng(52.259, 21.012), 2); 
                                " + Locations + @"
                                map.setUIToDefault();
                              }
                            }
                            </script> ";
    }

whole operation result in displaying empty site with no content. What am i doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:10:54+00:00Added an answer on June 18, 2026 at 12:10 am

    Problem was that i did wrong directories to my markers, so that cannot be seen on Map. Once i did enter valid directories everything works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing Google Maps service with PHP/CURL and currently have a problem with Maps
We have a strange problem when implementing sessions with ColdFusion in IE6. After login
I have got some problem implementing bullet physics into my opengl game. The thing
I have a problem with implementing a new design. While the anchor elements are
I have a problem implementing what should be a simple example with services. Following
I have a problem in implementing Mashups in PHP. Now I am using PHP
A rookie here. I have this specific issue in implementing Model View Presenter Pattern
I am implementing Google Maps in one of my pages. I know I need
I have just been implementing a google map, that pulls data from the yelp
I have a problem implementing this logic in my project. Im using ServiceLoader and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.