C# LinkButton.PostBackUrl - 没有 JS 的新窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1154520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 09:31:31 来源:igfitidea点击:
C# LinkButton.PostBackUrl - New window without JS
提问by Juri Bogdanov
Is it possible to use asp:LinkButton
without JavaScript to open new windows?
Currently i have workable next code, but with JS.
是否可以在asp:LinkButton
没有 JavaScript 的情况下打开新窗口?目前我有可行的下一个代码,但使用 JS。
<asp:LinkButton ID="lnkPcName" runat="server" OnClientClick="window.document.forms[0].target='_blank';" PostBackUrl='<%# Eval("ComputerId", "ComputerInfo.aspx?ComputerId={0}") %>'><%# Eval("pcName") %></asp:LinkButton>
采纳答案by Issa Qandil
As i know linkbuttonswere originally designed to do a postback to the same page
据我所知,链接按钮最初是为了回发到同一页面而设计的
If i were you i would use a hyperlinkcontrol instead
如果我是你,我会改用超链接控件