Insert a Virtual Earth Map in your asp.net page - Part 2

by Emanuele 6/20/2008 10:34:00 AM
In the first article, I describe how to insert and navigate a Virtual Earth Map in your asp.net page.
Here, I describe how to search a Point of Interest (POI) in your map.
The Map control includes a function called Find.
This function accepts ten parameters:

What: a string you want to search
Where: a string where you want to search
FindType: enum VEFindType (Now there is only value: Business)
ShapeLayer: a VEShapeLayer object where the pushpin are placed
StartIndex and NumberOfResults: parameters to manage the search results
ShowResults: if true, the pushpin are placed on the POI
CreateResults: if true, the pushpin are created
UseDefaultDisambiguation: if true, the default form is shown with much disambiguation in the first and second parameters
SetBestMapView: if true, the map moves automaticaly on the result
Callback: function called when the search are finished

In our example we use only the first and the second parameters.

Add the follow html code to the first example:

Search:
<input id="txtPOI" type="text" name="txtPOI"/>
<input id="txtAddress" type="text" name="txtAddress"/>
<input id="find" type="button" value="Find" name="find"
    onclick="Find();"/>

Add the follow javascript to the first example:

function Find()
{
    try
    {
        map.Find(
          document.getElementById('txtPOI').value,
          document.getElementById('txtAddress').value
        );
    }
    catch(e)
    {
        alert(e.message);
    }
}


Now, launch the page and try to search something.

In the attachment you find the example page that I created.

VirtualEarth2.zip (1.02 kb)

Related posts



Powered by BlogEngine.NET 1.3.1.0
Theme by Emanuele Bartolesi

About the author

Name of author Emanuele Bartolesi
I'm a senior developer and project manager.

Contact me Contact me

Calendar

<<  December 2008  >>
MoTuWeThFrSaSu
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Sign in

Download Day 2008