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

2

5

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.

Swaine answered 19/3, 2012 at 6:4 Comment(0)
H
10

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" }) %>
Hypersonic answered 19/3, 2012 at 6:27 Comment(2)
Please provide me solution in ASP.NET MVC.Swaine
Here's the same thing in ASPX View syntax: <%= Html.ActionLink("New Window", "Index", null, new { target= "_blank" }) %>Hypersonic
G
0

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.

Genaro answered 25/9, 2013 at 17:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.