How to open a new popup window by clicking an html action link in MVC?

允我心安 提交于 2020-01-11 05:29:07

问题


I've a view page in which there's an HTML ActionLink. Now on click of that action link, i want to open a new popup window without closing the previous one. In this new popup window i want to show my existing view page. please provide me a better solution.


回答1:


Specify the HTML 'target' attribute using the htmlAttributes parameter. In Razor:

@Html.ActionLink("New Window", "Index", null, new { target= "_blank" })

In ASPX syntax:

<%= Html.ActionLink("New Window", "Index", null, new { target= "_blank" }) %>



回答2:


Could not get the answers on here to work. I had to use

<%= Html.ActionLink("New Window", "Index", null, new { .target= "_blank" }) %>

This worked for me. It was just the silly little period at the beginning of target that was missing.



来源:https://stackoverflow.com/questions/9765701/how-to-open-a-new-popup-window-by-clicking-an-html-action-link-in-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!