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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:27:29+00:00 2026-05-31T12:27:29+00:00

Thank you in advance for all your help. I’m trying to use google maps

  • 0

Thank you in advance for all your help. I’m trying to use google maps api with the new mvc3 razor, however when I go to run my code nothing is being displayed except a tag. However, if I create an html file I can get the map to be displayed. I’m sure I’ll be banging my head at how obvious the answer is, but for the past couple of days I’ve been looking at this code and been unable to figure out how to get it to work in VS. Please help:

I have in my _Layout.cshtml

<!DOCTYPE html>
<html>
 <head>
  <title>@ViewBag.Title</title>
  <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
  <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
  <pre lang="aspnet">@RenderSection("Scripts", false)
  <style type="text/css"> 
    @RenderSection("Styles", false)
  </style>
 </head>

  <body>
    @RenderBody()
  </body>
</html>

In my Index.cshtml:

@{ 
  ViewBag.Title = "MVC 3 and Google Maps"; 
} 
@section Scripts { 
  <script type="text/javascript" 
src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> 
} 
@section Styles { 
  html { height: 100% } 
  body { height: 100%; margin: 0px; padding: 0px } 
  #map_canvas { height: 80% } 
} 
<script type="text/javascript">
  function initialize() {
    //var latlng = new google.maps.LatLng(40.716948, -74.003563);
    var options = { center: new google.maps.LatLng(-34.397, 150.644),
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById
        ("map_canvas"), options);
 }
 $(function () {
    initialize();
 });      
</script> 
<h2>Hello, Google Maps</h2>
<div id="map_canvas" style="width:80%; height:80%"></div>

This is all I’m working with right now, hopefully one of you can show me what I am missing. I’ve looked at several pieces of similar code already, but for some reason in VS it’s not wanting to display google maps, but like I said my does get displayed. Thank you for all your help!

  • 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-31T12:27:31+00:00Added an answer on May 31, 2026 at 12:27 pm

    I figured it out, it was a stupid syntax error as I figured it would be. The pre tag was missing it’s pre end tag. Thank you guys for your help.

    <pre lang="aspnet">@RenderSection("Scripts", false)</pre>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thank you in advance for your help. I am developing a java based tool
Thank you in advance for your help. Background: I have two TableViews (NSArray datasource)
Hi all and thanks in advance. I am new to the NoSQL game but
Greetings and thank you in advance for the help. I created a user control
I am new to programming and python so I thank you in advance for
This one has me pretty rattled so I thank you in advance for your
i have very serious problem if any tech expert can help...thank you in advance..
Sorry for the long explanation. Thanks in advance to all who are taking their
First of all thanks in advance, this has been very frustrating and I'm hoping
Thanks,in advance I want to remove all the zero size files in specified directory,can

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.