如何通过单击MVC中的html动作链接打开一个新的弹出窗口?

时间:2021-10-27 00:30:35

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.

我有一个视图页面,其中有一个HTML ActionLink。现在点击那个动作链接,我想要打开一个新的弹出窗口而不关闭之前的窗口。在这个新的弹出窗口中,我想显示我现有的视图页面。请给我一个更好的解决方案。

2 个解决方案

#1


10  

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

使用htmlAttributes参数指定HTML“目标”属性。在剃须刀:

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

In ASPX syntax:

ASPX语法:

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

#2


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.

这为我工作。这只是目标开始时那个愚蠢的小阶段。

#1


10  

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

使用htmlAttributes参数指定HTML“目标”属性。在剃须刀:

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

In ASPX syntax:

ASPX语法:

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

#2


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.

这为我工作。这只是目标开始时那个愚蠢的小阶段。