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

StringBuilder sb = new StringBuilder();
        sb.Append("<script type='text/javascript' src=''></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 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 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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.