Reputation: 485
I'm curious, is it possible to use multiple CSS classes on an ActionLink in MVC3 Razor syntax? The line below appears to load only the first class(btn) and skipps btn_c.
@Html.ActionLink("Administration", "Index", "Admin", null, new { @class = "btn btn_c" })
Upvotes: 4
Views: 4270
Reputation: 150
I am having this exact problem with bootstrap classes, I do not have another class overriding the bootstrap classes. In fact I verified through dev tools that I can add the "active" class to the "nav-link" class.
Here is my razor code:
@Html.ActionLink("Statement Info", "Edit", new { Controller = ViewBag.MyContoller}, new { name = "navAction", id = "Statements", @class = "nav-link active"})
When I view the element in dev tools, it only has the "nav-link" class
Upvotes: 0
Reputation: 4909
I've just used your existing ActionLink with the following css:
.btn
{
color: yellow;
}
.btn_c
{
background-color: red;
}
And it successfully produced the following output:
Upvotes: 2