I'm wondering if anyone has had any luck rendering a map inside a master page. I am getting the typical error: Internet Explorer cannot open the Internet Site [url] operation aborted. I see the map rendered on the page underneath the error. I'm calling the JavaScript in the ClientScript.RegisterStartupScript(//the javascript code) method. This will generate the call to the script on window.onload. I'm thinking that since my master page puts my content box within a table that this is causing the problem. Is it possible to render a map within content place holder in a table on a master page? Any insights would be appreciated.
I also tried putting the content holder outside the table and still had no success. I am using the RegisterStartupScript method because I have to query a database to get my lats and longs.
Your wrapper is awesome. Really good work. I'm definitely going to use it. I would still like to know why this problem was occurring even though it's a non issue now because of your control. Maybe it would've worked if I added a timeout option....I don't know. Thank you so much for your help.
Glad you like the control. The problem with IE is that it doesn't like it when you change the contents of DOM elements before the page is done loading. Now people hate IE because it complies with the standards :-)
There are some workarounds. The most popular is to run the map rendering code from the page body's load event. This is somewhat bothersome when working with masterpages. Another way is making a script block that uses the defer attribute, but this is not guaranteed to work cross-browser. Finally you can delay running the script manually by using a timeout, but this sometimes causes trouble with very busy pages.
As you can see there is not a golden solution when working with master pages as you don't have the possibility to write in the master file's markup. So you have to do it programatically or use options 2 or 3.
Thanks again. I had the map working using ajax very nicely passing back my lats and longs in an xml string and then using the xmlDom object to parse it in javascript and render the map. My user wanted the browsers back and forward buttons to bring back the previous map image, though....which brought me to this problem. I really appreciate your help.
Make sure you put the includes javascript component in the body of the page at the bottom.
Why? The reason your map dosnt work is because it launches before all the googlemaps calls have been made. by creating a function to incase your code in, you force the browser to load all external page content(ie google maps api) before lauching your personalized codes.
Thanks! The ClientScript.RegisterStartupScript(//the javascript code) places the call to the JavaScript below the html in the body and calls it during the window.onload method. I actually already have my javascript in another function and file. I was using the RegisterStartupScript function to pass xml back to the client that contained my lats, longs, and styles for icons on my map. I guess I could do a bunch of inline vbscript on the page to get at some server variables, but I wanted a more elegant solution.