ScriptLoadFailed Exception - MultiView or Visible=False

Dec 23, 2010 at 9:14 AM

Hi, 

I recently discovered this excellent control and have been getting to grips with its usage. I have an issue when I use the control within a Multiview control - my page has two views,  I have a list of addresses in a gridview in the first view, the second view allows the user to see the list of addresses on the map. I find if I set the default view to the one with the GoogleMap control in, it this functions correctly (I can switch views without a problem) However if the googlemap control isnt in the view that is loaded when the page is first rendered I get the following error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 3.5.21022; MDDS; SLCC1; .NET4.0C; OfficeLiveConnector.1.5; OfficeLivePatch.1.3)Timestamp: Thu, 23 Dec 2010 10:03:09 UTC

Message: Sys.ScriptLoadFailedException: The script 'http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAE5Xc6Y7vjZu5hwBqC-Pm1hS4ELu2oro8Kgk6o9lbhMxVtdsEYRSUhwyrq1ENDIu-5MKI5_oWLd2q9w' failed to load. Check for: Inaccessible path. Script errors. (IE) Enable 'Display a notification about every script error' under advanced settings. Missing call to Sys.Application.notifyScriptLoaded().Line: 1266Char: 13Code: 0URI: http://localhost:64964/ScriptResource.axd?d=UYY6s_yk2MYqbaqvzBli6UozuFuzUUcPIPrDwey9DQFif0OIQlmA-63AoxDZMZo0uSONIMyWJCzu9S0ivJzuCG3jycD0f5BP4OuGp5x7z1Sf3I0zPqNj-Z6Jmbp4fIoblF-AmtHVCrPy3KsHVqa-V_tG2ertKyGzgfDGMu-Ss8hN8PqO0&t=5c2f384e

This error appears whether I am using it as LocalHost or on the actual server. I get exactly the same error on a different page if I have the map set to visible="false" and have a button to show the map (set Visible="True").  

The control is initialised like this: 

<asp:View ID="mapView" runat="server"><

cc2:GoogleMap ID="GoogleMap1" Address="London, UK" Width="500px" Height="500px" Zoom="10" Key="ABQIAAAAE5Xc6Y7vjZu5hwBqC-Pm1hS4ELu2oro8Kgk6o9lbhMxVtdsEYRSUhwyrq1ENDIu-5MKI5_oWLd2q9w" runat="server" DefaultMapView="Normal" InsideUpdatePanel="True" IsStreetView="False" EnableGoogleBar="False" ZoomPanType="Small" IsStatic="False" StreetViewMode="Panorama" EnableMarkerManager="True"> </cc2:GoogleMap>        

</asp:View>

I was just wondering if there was a script call I can make to fix this?

Many thanks Bob

Jan 22, 2011 at 5:31 PM

Hello,

I am experiencing the same problem with a client's website on which I am using the GoogleMap Control.

When I switch to the view containing the GoogleMap Control, the page is not displaying the GoogleMap (I have tried on IE 9, Firefox, Opera and Chrome). So I assume it is a GoogleMap Control bug.

@Bob: have you found a workaround?

Thank you.

All the best,

Razvan

Jan 24, 2011 at 11:23 AM

Hi Razvan,

I did find a solution of sorts that seems to work for me, what I did was put a hidden googlemaps control (using div tags) inside the view that loads at pageload. 

Here's my code inside the view that is active when the page is loaded:

<DIV style="DISPLAY: none"><cc2:GoogleMap id="hiddenMap" runat="server" EnableMarkerManager="False" StreetViewMode="Panorama" IsStatic="False" ZoomPanType="Small" EnableGoogleBar="False" IsStreetView="False" InsideUpdatePanel="True" DefaultMapView="Normal" Key="my_key" Zoom="10" Height="1px" Width="1px" Address=""></cc2:GoogleMap></DIV> 

This seems to fix the problem as the other view (the one containing the real map) loads correctly, obviously replace the key with your key. The setting for the control aren't important as long as the actual control is loaded (although hidden)

It's prob not the best workaround ever but works well enough for my purposes.

Hope it helps

Cheers

Bob