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:

7 Years
Discussion Span
Last Post by phoenix_dwarf

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.