ASP.NET - Google maps not getting centered in IE

Asked By karur krishna madhu on 25-Jul-13 02:50 AM
I am working on an app which uses google maps to locate the places. it works perfectly fine in other browsers but when it comes to IE the image goes to the top right of the windows it is displayed partially the user everytime has to drag and get it to the center. the same is not happening in other browsers chrome and mozilla. it automatically comes to the center of the page. please find the screenshot attached.
Sathish S replied to karur krishna madhu on 25-Jul-13 03:17 AM
Hi,
Screen shot is not available. Which version of maps you are using v2 or v3?

Have tried setting the center property in the map option, like this
var map;
function initialize() {
 
var mapOptions = {
    zoom
: 8,
    center
: new google.maps.LatLng(51.50,-0.12),
    mapTypeId
: google.maps.MapTypeId.ROADMAP
 
};
  map
= new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions
);
}
karur krishna madhu replied to Sathish S on 25-Jul-13 05:31 AM
Hi sathish 

below is my code

 //initialize the map and overlays.
    var mapOptions = {
        location: { lat: 36.1748581950659, lng: -86.77890234374999 },
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        mapDivId: "map-canvas"
    };
    self.myMapClass = new window.taps.map(mapOptions);
    self.constants = new window.taps.constants(datacontext);
    self.constants.retrieveConfigurationSettings();


i dont know i am not able to upload the image.
Sathish S replied to karur krishna madhu on 25-Jul-13 06:07 AM
Try setting style for the div

 
<style type="text/css">
    html
    {
      height: 100%;
    }
    body
    {
      height: 100%;
      margin: 0;
      padding: 0;
    }
    #map-canvas
    {
      height: 100%;
    }
  </style>

 or try resizing using this code
 google.maps.event.trigger(map, 'resize');