Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
3.33/5 (2 votes)
I am using bing map in my webapplication and i have javascript functions to display map, add push pin
Below are the functions
var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), { credentials: "AlkUIczX_RUWzPNUFvZKvPibJQ6JRazm0A8GLA30WPMllJETWxw6ElDXZSe5ao84" });
//add pin to log,lat specified
function setMapLocation(lat,longit) {
    //    var location = new Microsoft.Maps.Location(48.03, -122.4);
    var location = new Microsoft.Maps.Location(lat, longit);
    var pushpin = new Microsoft.Maps.Pushpin(location);
    map.entities.push(pushpin);
    map.setView({ center: location, zoom: 10 });
}
// Add pushpin to location and get lat and long
function GetMap() {
    //Retrieve the location of the map center
    var center = map.getCenter();
    //Add a pin to yhe center of the map
    var pin = new Microsoft.Maps.Pushpin(center, { draggable: true });
    //    Add a handler top the pushpin drag
    Microsoft.Maps.Events.addHandler(pin, 'mouseup', DisplayLoc);
    map.entities.push(pin);
}
//Get lat and long. of the pushpin
function DisplayLoc(e) {
    if (e.targetType == 'pushpin')
     {
     var pinLoc = e.target.getLocation();
    return  pinLoc.latitude + ", " + pinLoc.longitude;
      }
}

I need to
1) pass latitude and longitude as parameter from my vb.net code to "setMapLocation" javascript function
2) get return value of "DisplayLoc" javascript function which is latitude and longitude to vb.net code.
Can anyone help me how to do this please....
Posted
Updated 22-Jun-11 1:59am
v2

1 solution

Instead of Microsoft map we can use google Maps and its api is easily available in Google Labs and Google apps.
 
Share this answer
 
Comments
Mythri_8 22-Jun-11 7:46am    
i know that but i need to use Bing map as my client need bing map in their website

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900