Hi Maria,
I have used Google Map in my asp.net application, so I think the below snippet will definitely helps you out
Script file that is used to find the location is
<script src="http://maps.google.com/maps?file=api&v=2&key=AIzaSyDBO2QQj003uS59ixG2h5QBHmIv7BTBU4Y&sensor=false">
type="text/javascript"></script>
<script type="text/javascript">
var map;
var geocoder;
var address;
$(document).ready(function () {
initialize();
});
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(17, 83), 5);
map.setUIToDefault();
}
findAddress();
}
function showAddress(addresess) {
geocoder = new GClientGeocoder();
geocoder.getLatLng(
address,
function (point) {
if (!point) {
alert("Sorry the given address [" + address + "] was not found!");
}
else {
map.setCenter(point, 15);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindow(address);
}
}
);
}
function findAddress() {
var ddl = document.newGetElementById("ddlLocations");
address = ddl.options[ddl.selectedIndex].value;
showAddress(address);
return false;
}
</script>
And my view html is
<asp:dropdownlist id="ddlLocations" runat="server" xmlns:asp="#unknown">
</asp:dropdownlist>
<asp:button id="btnGetAddress" runat="server" text="Get Address" onclientclick="return findAddress()" xmlns:asp="#unknown" />
<p />
<div id="map" style="width: 800px; height: 600px">
</div>
As you can the code is self explanatory, just keep it as reference.
Hope this helps you a bit.
Regards,
RK