I have an ASP.Net MVC application. I would like to create a view that lists the contents of a simple collection and show it in a new browser window.
Is there a way to show a view in a new browser window using a simple link?
I have struck out with Html.ActionLink. The Url.Action below does result in the Controller action being called but does not open in a new browser window.
Open MVC View in New Browser.
Is opening a view in a new browser window possible in MVC?
If so, does anyone know how?
You can specify target=_blank
in the HTML properties of your link to open it in a new window. There's a parameter on Html.ActionLink
that allows you to specify arbitrary HTML properties to add to your link, like so:
Html.ActionLink("Text", "Action", new { id = 1 }, new { target = "_blank" });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With