【问题标题】:ASP.NET MVC add css class to actionlink [duplicate]ASP.NET MVC 将 css 类添加到 actionlink [重复]
【发布时间】:2011-04-09 23:26:57
【问题描述】:

如何向此操作链接添加 CSS 类?我已经读到你做了类似new { class = button } 的操作,但我不确定在我的操作链接中放置它的位置:

<%= Html.ActionLink("View Performances", "Details", "Productions", 
                    new { name = item.show , year = item.year }, null) %>

【问题讨论】:

    标签: asp.net-mvc actionlink


    【解决方案1】:

    你可以试试

    <%= Html.ActionLink("View Performances", "Details", "Productions", 
            new { name = item.show , year = item.year }, 
            new {@class = "button"}) %>
    

    【讨论】:

    • 谢谢!如果您不想传入变量,您可以执行以下操作: Html.ActionLink("View Performances", "Details", "Productions", null, new {@class= "button"}) 如果您只想添加课程。此外,此元素的“产品”部分不是必需的。
    猜你喜欢
    • 2012-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多