Hello, I have a small project in asp.net / c # / javascript (to attack a google map)
on a asp.net page, I have a dropdownlist:
<asp:DropDownList ID="ddlAdr" runat="server" DataSourceID="SDSClient"
DataTextField="Name_client" DataValueField="ID_client" >
</asp:DropDownList>
<div id="button2" class="button" önclick="findAddress(); return false;">Chercher</div>
<asp:Button ID="btnsearch" Text="Search" runat="server" CssClass = "button" /> //c'est le meme boutton en haut
in the javascript code:
function findAddress() {
var address = document.getElementById("ddlAdr").value;
geocoder.geocode({ 'address': address }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var addrLocation = results[0].geometry.location;
map.setCenter(addrLocation);
document.getElementById('lat').value = results[0].geometry.location.$a;
document.getElementById('lng').value = results[0].geometry.location.ab;
var addrMarker = new google.maps.Marker({
position: addrLocation,
map: map,
title: results[0].formatted_address
});
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
My problem is that the dropdown list displays the name of the client, but he as a ClientID value, I do not know how to extract the data for the selected element from a database and:
- Put a marker according to the extracted address
- View other data: name, surname, ... in a infowindow
I managed to create a marker but not retrieve data from a database sql server and pass a geocoder
I managed also to fill my dropdownlist from the BD