No javascript/AJAX to be used.
没有javascript / AJAX可供使用。
when clicked on the hyperlink, it should open a new browser window.
当点击超链接时,它应该打开一个新的浏览器窗口。
4 个解决方案
#1
36
Basic HTML Anchor Element:
基本HTML锚元素:
<a href="http://www.w3schools.com/"
target="_blank">Visit W3Schools!</a>
ASP.NET WebForms HyperLink Element:
ASP.NET WebForms HyperLink元素:
<asp:HyperLink ID="HyperLink1" runat="server" Target="_blank">HyperLink</asp:HyperLink>
ASP.NET MVC Style:
ASP.NET MVC风格:
<%= Html.ActionLink<HomeController>(c => c.Index(), "Click me", new { target = "_blank" }) %>
All three open a new tab, would that suit your needs?
这三个都打开了一个新标签,是否符合您的需求?
#2
14
If you're not using javascript, you need to use the target="_blank". But to do it in a cleaner mvc fashion, do:
如果您不使用javascript,则需要使用target =“_ blank”。但要以更清洁的mvc方式做,请:
<%= Html.ActionLink("Click me", "ActionName", null, new {target="_blank"}) %>
#3
5
If your question is - How can I create pop-up window in asp.net mvc
如果您的问题是 - 如何在asp.net mvc中创建弹出窗口
The simple answer is : can't
简单的答案是:不能
For that matter you can't in PHP, JSP or any other server side scripting language.
就此而言,您不能使用PHP,JSP或任何其他服务器端脚本语言。
You noticed that the solutions above are all HTML?
你注意到上面的解决方案都是HTML?
The pop-up window is a domain that has to be handled client side. The server languages can spew HTML/Javsascript that have the commands to open a pop-up window. They intrinsically can't order the browser to open a window.
弹出窗口是必须在客户端处理的域。服务器语言可以使用具有打开弹出窗口命令的HTML / Javsascript。他们本质上无法命令浏览器打开一个窗口。
#4
3
<A Href="page.html" target="_blank">Link text </A>
The target="_blank" is the specific part you need.
target =“_ blank”是您需要的特定部分。
Alternatively you could use target="new". Here's an article that describes how the two behave differently.
或者你可以使用target =“new”。这是一篇描述两者表现如何不同的文章。
#1
36
Basic HTML Anchor Element:
基本HTML锚元素:
<a href="http://www.w3schools.com/"
target="_blank">Visit W3Schools!</a>
ASP.NET WebForms HyperLink Element:
ASP.NET WebForms HyperLink元素:
<asp:HyperLink ID="HyperLink1" runat="server" Target="_blank">HyperLink</asp:HyperLink>
ASP.NET MVC Style:
ASP.NET MVC风格:
<%= Html.ActionLink<HomeController>(c => c.Index(), "Click me", new { target = "_blank" }) %>
All three open a new tab, would that suit your needs?
这三个都打开了一个新标签,是否符合您的需求?
#2
14
If you're not using javascript, you need to use the target="_blank". But to do it in a cleaner mvc fashion, do:
如果您不使用javascript,则需要使用target =“_ blank”。但要以更清洁的mvc方式做,请:
<%= Html.ActionLink("Click me", "ActionName", null, new {target="_blank"}) %>
#3
5
If your question is - How can I create pop-up window in asp.net mvc
如果您的问题是 - 如何在asp.net mvc中创建弹出窗口
The simple answer is : can't
简单的答案是:不能
For that matter you can't in PHP, JSP or any other server side scripting language.
就此而言,您不能使用PHP,JSP或任何其他服务器端脚本语言。
You noticed that the solutions above are all HTML?
你注意到上面的解决方案都是HTML?
The pop-up window is a domain that has to be handled client side. The server languages can spew HTML/Javsascript that have the commands to open a pop-up window. They intrinsically can't order the browser to open a window.
弹出窗口是必须在客户端处理的域。服务器语言可以使用具有打开弹出窗口命令的HTML / Javsascript。他们本质上无法命令浏览器打开一个窗口。
#4
3
<A Href="page.html" target="_blank">Link text </A>
The target="_blank" is the specific part you need.
target =“_ blank”是您需要的特定部分。
Alternatively you could use target="new". Here's an article that describes how the two behave differently.
或者你可以使用target =“new”。这是一篇描述两者表现如何不同的文章。