I have tried to use the Google Map inside an updatepanel and it ended up giving me strange JavaScript error "javascript - Unable to get value of the property 'offsetWidth': object is null or undefined ".
After some research I found that it occurred when you have build your map when the Maps API JavaScript has not loaded. I as able to solve the issue when I load the map as displayed below.
<script type="text/javascript">
function initialize() {
var mapOptions = {
zoom: 6,
center: new google.maps.LatLng(7.0000, 81.0000),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("googleMap"), mapOptions);
});
}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.googleapis.com/maps/api/js?key=<your_api_key>&sensor=false&callback=initialize";
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
for more information refer http://stackoverflow.com/questions/5478450/google-map-error-a-is-null
Cheers
Samith
After some research I found that it occurred when you have build your map when the Maps API JavaScript has not loaded. I as able to solve the issue when I load the map as displayed below.
<script type="text/javascript">
function initialize() {
var mapOptions = {
zoom: 6,
center: new google.maps.LatLng(7.0000, 81.0000),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("googleMap"), mapOptions);
});
}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.googleapis.com/maps/api/js?key=<your_api_key>&sensor=false&callback=initialize";
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
for more information refer http://stackoverflow.com/questions/5478450/google-map-error-a-is-null
Cheers
Samith