I have a google map javascript link like:
string GoogleURL = “http://maps.google.com/maps?file=api&v=2&key=abcdefg”
I built a user control, which will register this script like this:
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), key, String.Format(“”, GoogleURL), false);
Then this control have other script which will call something from google API like:
google.maps.MapTypeId.ROADMAP
This user control will be placed in:
and it will be set as Visible=”false” default
When I click a button to fire AJAX, it set the visible equal true server side.
But I get a exception like this:
Microsoft JScript runtime error: Unable to get value of the property ‘ROADMAP’: object is null or undefined
If I put the user control out of updatepanel, everything goes well.
I tried write a script instead Google’s, ajax load it and run it, it still works.
I don’t know why this happen, does that because the AJAX load call each JS file at the same time, Google’s JS file takes more time so when the next JS file called it still in loading?
Thanks for any idea about how to solve this problem.
If my description is not enough detail please let me know.
Try to use this one or use similar technology for loading function.
http://api.jquery.com/ready/