通过使用以下代码,我可以在新窗口中打开它。但我想在同一个窗口或选项卡中打开
@Html.ActionLink( "Edit", "Edit", new { id=item.studentID },new {target="_blank"})
通过使用以下代码,我可以在新窗口中打开它。但我想在同一个窗口或选项卡中打开
@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 替换当前页面。
编辑:要作为弹出窗口打开,请指定您选择的宽度和高度。
@Html.ActionLink( "Edit", "Edit", new { id=item.studentID },null, new { @style= "width:100px; height:50px"})