Adding “class” attribute to htmlAttributes of the HtmlHelper in MVC

added by rawsoft
2/11/2010 8:58:43 PM

0 Kicks, 152 Views

I’ve seen lots of questions on how you can add a “class” attribute to any html tag such as the “a” tag while using the HtmlHelper class in ASP.NET MVC. The problem here is “class” is a reserved keyword in .NET so you just can’t use “class” in the htmlAttributes object of the HtmlHelper class. i.e. this will work perfectly.