【问题标题】:How do you add a class and style to an HTML.ActionLink which routes to a section如何将类和样式添加到路由到部分的 HTML.ActionLink
【发布时间】:2015-07-02 15:27:38
【问题描述】:

我有以下操作链接,它指向视图中的特定部分。

@Html.ActionLink("Morn Info", "Solutions", "Home", null, null, "EOB",null, null)

如何向此Html.ActionLink 添加样式和类,使其看起来像button

我觉得我可以添加...

new { @class = "button btn-flat", @style = "border-radius: 14px;" }

但我无法让它像这样工作......

   @Html.ActionLink("Early Out Billing", "Solutions", "Home", new { @class = "button btn-flat", @style = "border-radius: 14px;" }, null, "EOB", null, null)

【问题讨论】:

    标签: asp.net-mvc asp.net-mvc-routing html.actionlink


    【解决方案1】:

    htmlAttributes 是 ActionLink 构造函数中的最后一个值。

    @Html.ActionLink("Morn Info", 
    "Solutions", 
    "Home", 
    null, 
    null, 
    "EOB", 
    null, 
    new { @class = "button btn-flat", @style = "border-radius: 14px;" })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-09
      • 2012-05-19
      • 1970-01-01
      • 1970-01-01
      • 2014-03-09
      • 2015-04-12
      • 1970-01-01
      • 2017-01-06
      相关资源
      最近更新 更多