How do I add a class to an @Html.ActionLink?

后端 未结 5 483
旧巷少年郎
旧巷少年郎 2020-12-01 09:29

I have two @Html.ActionLink\'s that I want to make look like buttons. I\'m able to make this happen with CSS but only if I use the #ID of the actio

5条回答
  •  死守一世寂寞
    2020-12-01 09:52

    You have to indicate the action name, controller and url parameters (null in this example)

    @Html.ActionLink("Link Name", 
    "ActionName",
    "ControllerName",
    null,
    new { @class = "your css class" }
    )
    

提交回复
热议问题