I just checked in an initial prototype of a reusable Virtual Earth component for ASP.NET MVC. The “VEToolkit.Web.MVC.Map” component is written as an Extension to the ASP.NET MVC AjaxHelper class, and allows for a simpler experience when implementing Virtual Earth mapping within ASP.NET MVC applications. This is an early prototype of what the component will be; it’s not a final release; but you are free to use it.
Download the latest Change Set of VEToolkit
The code is subject to change at any time, since this is currently in a prototype stage, but below is a basic overview of what’s there so far. <h3>Include a Basic Map on the Page</h3>
Include the “VEToolkit.Web.MVC” namespace within the page by adding the following Include directive to the top of the Page: <pre class="csharpcode"><%@ Import Namespace="VEToolkit.Web.MVC" %></pre>
Add the following to the Page to add a basic Virtual Earth map:
And that’s it; you’ll have “default” sized Virtual Earth map on the page.
Specify you own name for the global VEMap Variable that’s used
Here’s an example of how to specify your own ID (or variable name) to be used for the global VEMap object that’s created:
Now to get a hold of the global reference to the VEMap object, you can just access it by name, like so:
<input type="button" value="Zoom In" onclick="myMap.ZoomIn();" /> <input type="button" value="Zoom Out" onclick="myMap.ZoomOut();" />
Set a couple Map Properties
Here’s a modified example of the above that sets the Center Location, Zoom Level and Map Style:
<%=Ajax.Map("myMap") .SetCenter(new Location(44, -78)) .SetZoom(6) .SetMapStyle(MapStyle.Road)%>
Here’s an example:
As stated above, this is just a basic overview of what’s been implemented so far in the VEToolkit ASP.NET MVC Prototype. There are a couple more things in there than I mentioned above, but I thought I’d keep the intro very basic until development moved further along.
- 01 Jul 2020
- 06 Apr 2020
- 02 Jan 2020
- 24 Jul 2019
- 10 Oct 2020
- 01 Jul 2020
- 06 Apr 2020
- 11 Mar 2020
- 15 Feb 2020
Recent on Build5Nines.com
- 04 Dec 2020
Latest Cloud News: Apple on K8s, IoT, Microsoft Pluton and more! (November 20, 2020 Build5Nines Weekly)20 Nov 2020
Latest Cloud News: .NET 5 Released, Apple Silicon M1 CPU, and more! (November 12, 2020 Build5Nines Weekly)12 Nov 2020
- 11 Nov 2020
Latest Cloud News: Kubernetes, Terraform, Teams Multi-Login and more! (November 5, 2020 Build5Nines Weekly)05 Nov 2020
This site is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. We also participates in affiliate programs with Udemy, and other sites. This site is compensated for referring traffic and business to these companies.