DWD


I hope this is a really stupid question, and there is an easy answer, but I have been trying for some time and just can't get started!

I have an existing asp.net site, using all the features - master pages, ajax etc - and now I want to add a virtual earth map. So I tried adding a reference to the VE script library. The obvious place was in the ScriptManager (actually the proxy, as there is a ScriptManager in the site Master Page):

<asp:Content ID="Content1" ContentPlaceHolderID="Main" runat="server">
<aspTongue TiedcriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<aspTongue TiedcriptReference Path="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5" />
</Scripts>
</aspTongue TiedcriptManagerProxy>
</asp:Content>

Just adding this really messes with my page layout! Somehow it shifts the page to the left (such that I can't scroll to it) and makes it wider than the window (but at least I can scroll to the right).

So my next attempt was to put it in the <head> of the master page:

<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5"/>

This causes problems in the ASP.NET AJAX framework.

In Sys$WebForms$PageRequestManager$_initializeInternalthere is an error as this._form is not set. This is because document.getElementById('aspnetForm') fails to find the form!

If I put the <script> in the master page just before the </body> then the page loads OK - no script errors, no layout changes - but ... the Virtual Earth Map control is unknown to my script, so I can't use it :-(

Any ideas what is going wrong (or what this script is doing to my styles etc) or how I might fix it Or even how to debug the problem Or anything I can do to move forward!





Re: Stupid NUBE problem!

SnoopDoug_98205


Change the script tag in the head to:

<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5"></script>

doug






Re: Stupid NUBE problem!

SoulSolutions

Thats really weird, I am doing that exact same thing for a client today, using a proxy to load V5 js.

I'll let you know if a spot anything but I am not seeing these issues at all. I wonder if it is something else or some ill formed html. What doctype are you using

ASP.NET AJAX literally just puts it in as a <script></script> into the body.

Very strange, I'll let you know.

John.







Re: Stupid NUBE problem!

DWD

Doug:

Thanks! Changing <script /> to <script></script> has done the trick, so I now have a workaround. Rather curious why (logically) equivalent markup should cause such problems. However the layout is still not quire as I would expect. Which leads me on to ...

John:

I agree it should work, the only difference is the placement. Using Doug's suggestion I have been placing the script at different points in the page. It appears that if it is before my stylesheets it is OK (well sort of, the layout is only a little wrong, not completely unusable), however if it is after my stylesheets all goes crazy!

This set me wondering. I know early versions of VE needed a separate stylesheet. Does the script do some initialization to programatically download or declare some styles/classes I wonder if they clash with some of my styles. If so, (and I could work out where the problem is) a rename may help.

I would like to fix this properly, as I tried using the PietschSoft server control, but it has the same issue (as it is using the ResourceManager to load the script)

--

David






Re: Stupid NUBE problem!

SnoopDoug_98205

I recently updated the SDK doc scripts so that they all begin:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5"></script>
<script>

...

</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>

...

If you find any issues with placement of styles, let us know.

doug





Re: Stupid NUBE problem!

DWD

One extra interesting discovery - I had the problems on my development machine using IE6. On a test machine with IE7 it rendered OK.

Not sure if that helps at all. I suspect it is some sort of issue with styles, but still not sure what. Alas, I am not an expert with CSS. I just google for examples of the effect I want and copy them. I usually understand how it works at the time, but quickly forget.






Re: Stupid NUBE problem!

DWD

SnoopDoug_98205 wrote:

If you find any issues with placement of styles, let us know.

Well, I think I have found it (after tracking through the stylesheets that get dynamically loaded)!

My layout uses the "Jello Mold" technique, which places horizontal padding on the body tag. VE loads a stylesheet ero.css which has the following rule:

html, body
{
margin: 0;
padding: 0;
height: 100%;
}

So if my css is after this it works (hence the script tag in the header is OK) but if this is after my css it fails (hence the ScriptResource has a problem).

So to fix my problem I have added (yet another) div with the padding on, so that the ero.css rules don't interfere with it!

--

David