here's a portion of my code:
<asp:HiddenField id="hdnLocationLatLng" runat="server" Value="0" />
and I'm trying to set the value of hdnLocationLatLng to the value of the latlng of the marker's current position, using this:
google.maps.event.addListener(map, 'click', function (event) {
if (marker) {
marker.setMap(null);
}
marker = new google.maps.Marker({
position: event.latLng,
map: map,
draggable: true,
title: "My Event's Location",
});
document.getElementById("#<%= hdnLocationLatLng.ClientID %>").value = marker.getPosition();
});
but everytime I click on the map, I got the error:
Uncaught Type Error: Cannot set property 'value' of null.
FYI, I can get the value of marker.getPosition() without any problem (tried to display it in alert and it returns the right value).
document.getElementById("#<%= hdnLocationLatLng.ClientID %>")
Remove # char