我有以下内容
@Html.ActionLink("Edit", "EditProg", new { id = item.ID })
我想知道如何为上面的内容提供一个名称,因为我需要在提交之前捕获这个名称。有没有像 name = "EditLink"
这样的东西?
最佳答案
您的意思是向 anchor 添加一个 name
属性(即使该属性在 anchor 上无效)?
@Html.ActionLink(
"Edit", // linkText
"EditProg", // actionName
new { id = item.ID }, // routeValues
new { name = "EditLink" } // htmlAttributes
)
或者将它作为查询字符串参数发送到 Controller ?
@Html.ActionLink(
"Edit", // linkName
"EditProg", // actionName
new { // routeValues
id = item.ID,
name = "some name"
}
)
关于asp.net-mvc - 带名称的 MVC @Html.ActionLink,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8659201/