无法设置 属性 'value' 为 null

Cannot set property 'value' of null

这是我的部分代码:

<asp:HiddenField id="hdnLocationLatLng" runat="server" Value="0" />

我正在尝试将 hdnLocationLatLng 的值设置为标记当前位置的 latlng 值,方法是:

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();
                        });

但每次我点击地图时,我都会收到错误消息:

Uncaught Type Error: Cannot set property 'value' of null.

仅供参考,我可以毫无问题地获取 marker.getPosition() 的值(尝试在警报中显示它并且 returns 正确的值)。

document.getElementById("#<%= hdnLocationLatLng.ClientID %>")

删除#个字符