Im doing some stuff in the code behind page and then putting that data into javascript respectively. This javascript is then connected to the asp.net page with a literal control. I.E.

StringBuilder sb = new StringBuilder();
        sb.Append("<script type='text/javascript' src='http://www.google.com/jsapi?key=ABCDEFG'></script><script type='text/javascript'>google.load('maps', '2'); ...SOME MORE CODE HERE.... }");

sb.Append("function createMarker(point, htmlSTR) { var marker = new GMarker(point); GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(htmlSTR); }); return marker; }");
        sb.Append("for (var i = 0; i < lat.length; i++) { var point = new GLatLng(parseFloat(lat[i]), parseFloat(lon[i])); var marker = createMarker(point, htmll[i]); map.addOverlay(marker); }");

litScript.Text = sb.ToString(); //this is the literal control

Why do I get an error "GlatLng is undifined"? When i put this javascript part of the code just plainly in my asp.net page it gives no errors... What gives?

Thanx for any help in advance! :icon_idea:

I see now that none of the Google Maps built-in properties wants to work like this...They all say "...*... is undefined".

Ok, what i did is i moved most of the javascrpit back to the asp.net page en now only sending the arrays through to the literal control and everything works perfectly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.