2011-07-22 26 views

回答

3

只需使用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> 
0
@Html.ActionLink("Register", "Register", "Users", null, 
    new {title = "Register your ID", rel="nofollow") 

框架將解析該對象,並把項目作爲渲染錨屬性。

相關問題