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 6610367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:49:55+00:00 2026-05-25T19:49:55+00:00

I am trying to display a simple map in an ASP.NET page that has

  • 0

I am trying to display a simple map in an ASP.NET page that has a Master Page. Everything works fine when I put the code in a static HTML page but nothing displays when using asp.net not even an error. When comparing the request/response in fiddler I can see that google is not sending any images back when using asp.net master page.

Here’s my client side code (I can hit a break point here):

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map_canvas { height: 100%; background-color:#eeeeee;}
    </style>

    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
        function initialize() {
            var latlng = new google.maps.LatLng(-34.397, 150.644);
            var myOptions = {
                zoom: 8,
                center: latlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var mapDiv = document.getElementById("map_canvas");
            var map = new google.maps.Map(mapDiv, myOptions);
                }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div id="map_canvas" style="width:100%; height:100%"></div>
</asp:Content>

I call the script from the server:

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim mybodytag As HtmlGenericControl
mybodytag = Page.Master.FindControl("mainbody")
mybodytag.Attributes.Add("onload", "initialize()")
End Sub
  • 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-05-25T19:49:56+00:00Added an answer on May 25, 2026 at 7:49 pm

    Found the solution. I changed the div % to a fixed px size and it worked:

    <div id="map_canvas" style="width:800px; height:600px"></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get an ASP.Net MVC2 app to display a simple custom
I'm trying to figure out a way to display a simple countdown that displays
I am trying to display a simple marker on my map. I follow all
I have a simple HTML page (ratings.html) that I'm trying to test using HtmlUnit.
I am trying to develop a simple map application, which will display a map
I am trying to display a simple graph using pydot. My question is that
i'm trying to use IvoryGoogleMap to display a simple map with markers and infoWindows
I am trying to write a very simple RSS channel which would display the
I am trying to create a simple app that displays a list of items
Im trying to display a simple immediate mode sets of textured polygons with pyOpenGL

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.