[英]NavigateUrl=“#” navigates to next page - ASP.Net Hyperlink
我在ASP.Net中声明了以下超链接。
<asp:HyperLink ID="lblPostcode" runat="server" Text='<%# Eval("POSTCODE") %>'
NavigateUrl="#" Target= "_blank"
onClick ='<%# String.Format("ViewGoolgeMap(\"{0}, {1}, {2}\")",Eval("ADDRESS").ToString(),Eval("TownCITY").ToString(),Eval("POSTCODE").ToString())%>' />
然后下面的javascript方法,从上面的超链接调用。
function ViewGoolgeMap(pid) {
window.open("https://www.google.co.uk/maps/place/" + pid + "", "Map" + pid, "width=500px,height=520px,left=20,top=20");
}
实际结果是它正在打开弹出窗口,但是在打开弹出窗口后,它立即导航到错误页面,指出
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
所需的解决方案是仅应打开弹出窗口。 没什么需要做的。
非常感谢。
在onClick
处理程序中返回false
将停止页面以执行href
function ViewGoolgeMap(pid) {
window.open("https://www.google.co.uk/maps/place/" + pid + "", "Map" + pid, "width=500px,height=520px,left=20,top=20");
return false; //Changed here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.