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

SRV picture SRV · Mar 19, 2012 · Viewed 15.7k times · Source

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.

Answer

McGarnagle picture McGarnagle · Mar 19, 2012

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" }) %>