如何在mvc视图的同一窗口中打开表单

How to open form in same window of mvc3 view?

本文关键字:窗口 表单 mvc 视图      更新时间:2023-09-26

通过使用以下代码,我可以在新窗中打开它。但我想在同一窗口或标签

中打开
@Html.ActionLink( "Edit", "Edit", new { id=item.studentID },new {target="_blank"}) 
new {target="_blank"}
上面的代码强制窗体在新窗口中打开。要强制表单在同一窗口中打开,需要删除target = _blank。
因此,更新后的代码看起来像这样:
@Html.ActionLink( "Edit", "Edit", new { id=item.studentID }, null )

{target="_blank"}替换为{target="_self"},此URL将替换当前页面

EDIT:要以弹出窗口的形式打开,请指定宽度和高度。

@Html.ActionLink( "Edit", "Edit", new { id=item.studentID },null, new { @style= "width:100px; height:50px"})