c# - passing css class name to asp.mvc view helper -


In ASP.NET MVC view assistant, you can do something like

  & lt ;% = Html.ActionLink ("Click me", "DoSomething", blank, new {someAttribute = "a value"})%>  

which will produce the following HTML

  & lt; A href = "doSomething" some attribute = "one value" & gt; Click me & lt; / A & gt;  

My question is ... What if I want to set the "class" attribute?

  & lt;% = Html.ActionLink ("click me", "doodonting", blank, new {class = "a-class-name"})%>  

This will not compile because "class" is a reserved word.

Is there a work-around?

Yes, using this:

    

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -