{"id":7080,"date":"2014-05-19T04:12:44","date_gmt":"2014-05-19T04:12:44","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/19\/multiple-markers-for-google-maps-api-v3-with-literal-asp-net-control-collection-of-common-programming-errors\/"},"modified":"2014-05-19T04:12:44","modified_gmt":"2014-05-19T04:12:44","slug":"multiple-markers-for-google-maps-api-v3-with-literal-asp-net-control-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/19\/multiple-markers-for-google-maps-api-v3-with-literal-asp-net-control-collection-of-common-programming-errors\/","title":{"rendered":"Multiple Markers for Google Maps API V3 With Literal Asp.Net Control-Collection of common programming errors"},"content":{"rendered":"<p>I am using the following code to add Marker in Google Maps (API V3) , I use XML file for store locations<\/p>\n<pre><code> protected void Page_Load(object sender, EventArgs e)\n        {\n            string locations = \"\";\n            string lastlat = \"\", lastlng = \"\";\n\n            XDocument xmlDoc = XDocument.Load(Server.MapPath(\"~\/App_Data\/Map.xml\"));\n            var query = from st in xmlDoc.Descendants(\"Position\")\n                        select st;\n\n            foreach (var p in query)\n            {\n                lastlat = p.Element(\"Latitude\").Value;\n                lastlng = p.Element(\"Longitude\").Value;\n                locations += \"var marker = new google.maps.Marker({position: new google.maps.LatLng(\" \n                    + p.Element(\"Latitude\").Value + \",\" \n                    + p.Element(\"Longitude\").Value + \"),info:\\\"\" \n                    + p.Element(\"Name\").Value + \"\\\",title:\\\"\"\n                    + p.Element(\"Name\").Value + \"\\\",map: map});marker.setMap(map)\";\n            }\n            Label1.Text = locations;\n            js.Text = @\"function initialize() { var myLatlng = new google.maps.LatLng(\" + lastlat + \",\" + lastlng + \"); var myOptions = {zoom: 16, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById('map'), myOptions);\" + locations + \"marker.setMap(map);}\";\n        }\n<\/code><\/pre>\n<p>and this code<\/p>\n<pre><code>\n    \n    <\/code><\/pre>\n<table width=\"100%\" border=\"1\"><\/table>\n<p>but do not show map in webpage!!!<\/p>\n<p>This gives two error<\/p>\n<pre><code>   Uncaught SyntaxError: Unexpected token var\n    Uncaught ReferenceError: initialize is not defined \n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I am using the following code to add Marker in Google Maps (API V3) , I use XML file for store locations protected void Page_Load(object sender, EventArgs e) { string locations = &#8220;&#8221;; string lastlat = &#8220;&#8221;, lastlng = &#8220;&#8221;; XDocument xmlDoc = XDocument.Load(Server.MapPath(&#8220;~\/App_Data\/Map.xml&#8221;)); var query = from st in xmlDoc.Descendants(&#8220;Position&#8221;) select st; foreach (var [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7080","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7080"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7080\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}