views:

50

answers:

1

Ok, I cant find the answer to this:

<%: Html.ActionLink("Click Here", "Action", null, new {class="myClass"})%>

I want to set the CSS class attribute of the generated element.

Obviously, C# will not allow me to use "class" as the name of an object's member.

What should I do?

+4  A: 

Can You try with escaping the class with : @.

So, please modify your code to :

<%: Html.ActionLink("Click Here", "Action", null, new {@class="myClass"})%>
Siva Gopal