You already saw few blog posts and announcements regarding release of July 2008 CTP of Windows Live Tools. With this release, we have introduced ASP.NET Server Control for Virtual Earth (Map Control).

Developers have been using JavaScript Control for meeting their needs. Now, you have ASP.NET control available right from your Visual Studio toolbox which you can drag and drop on your web page, do server side web page programming (e.g. pull store locations or last location of the delivery vehicle etc.) and create push pins and show to the web site visitors.

In words of Marc Schweigert, Microsoft’s Developer Evangelist

”This is a sweet control that makes integrating Virtual Earth into your ASP.NET applications a easy as drag, drop, set some properties, and wire up some server side code.  The new control, which is built on top of ASP.NET AJAX, does all the heavy lifting you've come to expect from ASP.NET AJAX enabled controls.  ASP.NET AJAX also introduced the concept of control extenders.  Extenders allow you to add AJAX functionality to existing server controls.  The Virtual Earth ASP.NE T control ships with a ton of extenders that allow you to interact with the map without writing any code.  I had the luxury of getting early access to the bits.  I've taken the control for a thorough test drive.  I think ASP.NET developers are going to love this thing!”

In words of Mark Brown, Virtual Earth Evangelist

”Integrating interactive, immersive maps no longer requires JavaScript, it can be done by ASP.NET developers simply. For smooth interactions this control can be combined with ASP.NET AJAX capabilities to provide the power of ASP.NET Serverside processing without the development overhead of coding JavaScript.”

Mark and Angus have an introductory channel9 screencast for you.



With July 2008 CTP, we are releasing this control to Microsoft’s download center as well as Windows Live Dev Connect site. This CTP also fixes few other bugs which are noted in the release notes. In this post, I would only talk about Map Control.

Map control derives from ScriptControl Class and wraps JavaScript control with necessary ASP.NET interfaces that gives developers server side methods and events in addition to client side methods and events. Thus Map Control would require a ScriptManager control to be added to the web page.

Virtual Earth Toolbox Tab  After you installed this CTP, you would get two new toolbox tabs – Windows Live and Virtual Earth. Virtual Earth toolbox tab provides Map Control and Extenders. 

Extenders are way to add ASP.NET Ajax Client Behaviors to server controls. These extenders perform the operations on Map Control – client side only. You don’t have to write extra JavaScript for doing this – you get this functionality out of the box.

Map Control can be dragged and dropped on the web page you are working on. Here’s how control would look like when you drag and drop on the web page.
Map Control after drag and drop on web page

Before we hit F5 and see how this would look like, set the center for the map and zoom level. You could set it at design time as well as at run time.
   

HTML Markup for the Map Control.

clip_image002[16] 
   
You can use property grid to edit/set properties you need to get the control start as you want.

For example – Center, Mode (2D/3D), Style (Road, Shaded, Aerial etc.) Zoom Level etc.
Map Control Property Grid

You can set these properties programmatically say in Page_Load event. This is simple code similar to what you would do for any server control. For example, following code would set the center of the Map to Microsoft’s Main Campus in Redmond, Washington, USA.

Page_Load event and setting properties for the Map Control 
When you run the web page, following Map is rendered in the web page.
Map showing Microsoft's Main Campus in Redmond, Washington, USA

Besides this, Map Control provides functionality for finding businesses, getting directions,
importing KML or Virtual Earth Collections, Bird’s Eye and 3D imagery, Traffic information etc. I
would briefly talk about importing Virtual Earth Collections in this post and discuss other features in future posts.

Importing Virtual Earth Collections:
Not only KML or GeoRSS, Map Control allows you to import Virtual Earth Collections and
map them. For Example, following code would import a collection from
http://maps.live.com which defines a neighborhood called Education Hill in Redmond, Washington, USA.
image

When the above code is executed, Map control renders following:

image

We would love to hear your feedback. As you might have noticed that our developer community asked for
a) Transparent background for IDLoginStatus
b) Medium Trust deployment for these controls
c) Drag and Drop control for Virtual Earth Map

We have provided these features and would love to hear your scenarios. Please drop your suggestions/bugs at Windows Live Dev Connect Feedback site.

Update: corrected links and minor formatting