Specifying CSS classes and html attributes with MVC helpers

July 16, 2011

Ok you’ve finally got you MVC controller and models all wired up, you BL is fine, now you want to pretty up those views, so you’ll start to use some css and javascript.

Here’s how you can specify html attributes with your html helpers.

Button sample:

_Form sample:

_

Note @ is used to escape the c# keyword class.