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

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -