0
我有以下幾點:我如何添加相對=「nofollow我的ActionLink的
@Html.ActionLink("Register", "Register", "Users")
我想使鏈接包括以下內容:
title="Register your ID"
rel="nofollow"
有沒有一種方式,我可以用MVC3做到這一點
我有以下幾點:我如何添加相對=「nofollow我的ActionLink的
@Html.ActionLink("Register", "Register", "Users")
我想使鏈接包括以下內容:
title="Register your ID"
rel="nofollow"
有沒有一種方式,我可以用MVC3做到這一點
只需使用ActionLink
方法的正確超載:
@Html.ActionLink(
"Register", // linkText
"Register", // actionName
"Users", // controllerName
null, // routeValues
new { // htmlAttributes
title = "Register your ID",
rel = "nofollow"
}
)
應該產生(假設默認路由設置):
<a href="/Users/Register" rel="nofollow" title="Register your ID">Register</a>
@Html.ActionLink("Register", "Register", "Users", null,
new {title = "Register your ID", rel="nofollow")
框架將解析該對象,並把項目作爲渲染錨屬性。
如果您不想使用操作鏈接,您可以選擇:Register – Dismissile