Can I add a CSS class definition to the Html.LabelFor in MVC3?

后端 未结 2 1691
孤城傲影
孤城傲影 2020-12-28 19:29

I hope someone out there has some ideas. I would like to tidy up my code and so I already used the Html.LabelFor. However now I want to assign a CSS class to the labels.

2条回答
  •  悲哀的现实
    2020-12-28 19:47

    There is no built in way to do this in MVC 3. You will have to write your helper that does this. Take a look at the LabelExtensions class to see how it is done.

提交回复
热议问题