Jun
30
Written by:
jbonnie
Friday, June 30, 2006 9:09:06 PM
This is a quick overview of how Virtualearth can be integrated into Dotnetnuke
The best way to get started with VirtualEarth is to check out Dr Neil's site www.viavirtualearth.com. There is a number of how to articles and an excellent collection of demonstration sites.
Microsoft has also posted samples, and a reference guide at http://dev.live.com/virtualearth/sdk/
You can always frame in www.local.live.com into your DNN site, but where is the fun in that!!!
The simplest way that I have gotten virtualearth into DNN is by updating your modules ASCX file in HTML edit mode
1) Add a reference to the VE 3 javascript from Microsoft
<script
src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js">
</script>
2) putting an html element, such as a DIV into your modules ASCX page
<div id='myMap' style=" position:relative;width:600px; height:400px;"></div>
3) place a routine into the ASCX page that loads the MAP
<script>
var map = null;
function MyOnPageLoad()
{
map = new VEMap('myMap');
map.LoadMap(new VELatLong(42, -96.1093), 8, 'r', false);
}
</script>
4) Ensure that your routine is called and the maps get loaded
a) Dr Neil does this with an onload event in the browser as follows:
<body onload="MyOnPageLoad();">
b) I have been doing this by registering my routine with DNN and having the DNN Client API place a call to the onpageload routine
DotNetNuke.UI.Utilities.DNNClientAPI.AddBodyOnloadEventHandler(Page, "MyOnPageLoad();")
Tags: