【发布时间】:2013-04-18 07:08:53
【问题描述】:
我当前在Index.cshtml页面中的代码:
@Html.ActionLinks(@Html.ActionLink(objList.Name, "Name", "ControllerName", new {Id=objList.Id}, new {target = "_blank"}))
上面的代码使我在单击Index 页面中的链接后在新选项卡中打开一个页面(Name.cshtml)。但我的目标是为新标签分配一个名称(objList.Name)作为Title。
所以,我在下面的代码中添加了 Title 属性,但它没有按预期工作。
@Html.ActionLinks(@Html.ActionLink(objList.Name, "Name", "ControllerName", new {Id=objList.Id}, new {target = "_blank", title = objList.Name}))
如何做到这一点?
【问题讨论】:
-
In you name.cshtml 标记 -
我的标题 -
Thers 在
name.cshtml页面中没有提及为.. 的标记 -
是的 - 将该标记添加到您的 cshtml 页面 - 您不需要在 Action Link 中添加任何额外代码
标签: c# asp.net-mvc asp.net-mvc-3 razor asp.net-mvc-4