i trying test out google maps jquery in asp.net master \ child page scenerio. got around errors calling api (correct key , parameters) , runs fine no errors. followed execution through in debug many times , appears executing fine. problem map not show no matter try. using example google api docs - following code key changed :)
<asp:content id="headercontent" runat="server" contentplaceholderid="headcontent"> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html, body, #map-canvas { margin: 0; padding: 0; height: 100%; } </style> <script src="scripts/jquery-1.10.2.min.js" type="text/javascript"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=mykey&sensor=false"> </script> </asp:content> <asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <h2>the map should apprear here</h2> <div id="map-canvas"/> <script type="text/javascript"> function initialize() { var map = new google.maps.map( document.getelementbyid('map-canvas'), { center: new google.maps.latlng(37.4419, -122.1419), zoom: 13, maptypeid: google.maps.maptypeid.roadmap }); var marker = new google.maps.marker({ position: new google.maps.latlng(37.4419, -122.1419), map: map }); } google.maps.event.adddomlistener(window, 'load', initialize); </script> </asp:content>
problem <div id="map-canvas"/>
has no width
, height
set. set absolute values or percentage values.
Comments
Post a Comment