Reputation: 7289
I am creating an actionLink in MVC
@Html.ActionLink(item.someId, "SomeDetails", "SomeCase", new { userId = item.userId }, null)
Now i want to add color to it based on a variable i have calculated
for example if i am creating a td i am adding color to it like
<tr style="color:@currentColor">
is there a way like this to add color attribute to the actionLink that i have created? without adding @class="someClassName"
Upvotes: 0
Views: 44
Reputation: 348
The fourth param you are passing null is going to take a html object. so you can pass the class or style attribute in that param
@Html.ActionLink(item.someId, "SomeDetails", "SomeCase", new { userId = item.userId }, , new { @style="color:"+@currentColor })
Upvotes: 2
Reputation: 21376
You can do it like this ,
@Html.ActionLink(item.someId, "SomeDetails", "SomeCase", new { userId = item.userId }, new { @style="color:"+currentColor })
Upvotes: 2