Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.NET
<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:

JavaScript
function findAddress() {
    var address = document.getElementById("ddlAdr").value;
 
    // script uses our 'geocoder' in order to find location by address name
    geocoder.geocode({ 'address': address }, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) { // and, if everything is ok
 
            // we will center map
            var addrLocation = results[0].geometry.location;
            map.setCenter(addrLocation);
 
            // store current coordinates into hidden variables
            document.getElementById('lat').value = results[0].geometry.location.$a;
            document.getElementById('lng').value = results[0].geometry.location.ab;
 
            // and then - add new custom marker
            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);
        }
    });
}



CSS
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
Posted

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