1

I have an ASP.NET application that must perform the following steps.

    • In the PaginaUno.aspx populates and displays a gridview and the user selects a row.
    • Opens PaginaDos.aspx running a JavaScript and shows googlemap with the data collected in the PaginaUno.aspx

Problem: that in step two shows object map but without markers.

I can not either automatically function pintamarkers() JavaScript activated by an event of ASP.NET) show the markers that I have defined.

Manual implementation works because I have defined in javascript on PaginaDos.aspx a button that runs pintamarkers() when you click and show the markers.

I have tried to:

// body onload="pintamarkers()">

and sends the error

"Microsoft JScript runtime error: 'map' is null or not an object"

How I can make the function pintamarkers() to run automatically when you load the PaginaDos.aspx ?

Thanks in advance for your answers.

Halim Qarroum
  • 13,985
  • 4
  • 46
  • 71
GABO1957
  • 11
  • 2

1 Answers1

0

Looks like the map object hasn't loaded yet so ....

Am I allow to use JQuery? If so then

$(document).ready(function(){
    pintamarkers();
});

If not then check out this question

How to check if DOM is ready without a framework?

but as you can see it will take a lot more code

Edit

Just generally - i would imagine that the body onload would work. Could it be that you are calling pinttamarkers then initialising the map when the page loads i.e. have you got an initialise call embedded in the page that will run separately to the onload event

This question had something similar

'__e3_' is null or not an object - google maps

Anyway just another thought

Community
  • 1
  • 1
Crab Bucket
  • 6,219
  • 8
  • 38
  • 73
  • Thanks for your help I will see the league you recommend me – GABO1957 Jul 04 '13 at 15:29
  • I would recommend learning JQuery and using it if you can. I appreciate there are constraints on projects that mean that sometimes the choice of technologies/components isn't yours to make. But it is useful and a timesaver if you can (apologies if you know all this) – Crab Bucket Jul 04 '13 at 15:38
  • Hi Crab the solution is include pintamarkers() in my function initialize() in the javascritp of PaginaDos.aspx function initialize() { var oxford = new google.maps.LatLng(25.677027, -100.258950); var mapOptions = { zoom: 14, center: oxford, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions); pintamarkers();//here include } thanks for youre help Hi form Monterrey Mexico. – GABO1957 Jul 04 '13 at 22:48
  • 1
    No probs. Hi from Leeds, UK – Crab Bucket Jul 05 '13 at 07:31