hello,
i have this dropdown i want if user select usa in dropdown then search autocomplete in textbox so only usa area comes in auto complete if user select Canada in dropdown and search in google autocomplete text box so only Canada area come
please advice
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>USA</asp:ListItem>
<asp:ListItem>Canada</asp:ListItem>
</asp:DropDownList>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false&key="></script>
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function () {
//var options = { types: ['(cities)'] };
var places = new google.maps.places.Autocomplete(document.getElementById('<%=txtlocation.ClientID%>'));
google.maps.event.addListener(places, 'place_changed', function () {
var place = places.getPlace();
var address = place.formatted_address;
var latitude = place.geometry.location.lat();
var longitude = place.geometry.location.lng();
var mesg = "Address: " + address;
mesg += "\nLatitude: " + latitude;
mesg += "\nLongitude: " + longitude;
//alert(mesg);
});
});
</script>