我可以一个CSS类定义添加到MVC3的Html.LabelFor? [英] Can I add a CSS class definition to the Html.LabelFor in MVC3?
问题描述
我希望有人在那里有一些想法。我想整理一下我的code,所以我已经使用了Html.LabelFor。但是现在我要一个CSS类分配给标签。
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.
Html.LabelFor(model => model.Customer.Description ????)
没有人有知道这是可能的MVC3。注意它的MVC3我使用。我已经看到谈到MVC2一个职位,而且是没有简单的解决方案。
Does anyone out there know if this is possible in MVC3. Note it's MVC3 I am using. Already I saw a post that talked about MVC2 and there being no simple solution.
推荐答案
有没有内置的方式做到这一点的MVC 3,你必须写你的助手,做这一点。看看在 LabelExtensions
类,看看它是如何做的。
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.
这篇关于我可以一个CSS类定义添加到MVC3的Html.LabelFor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!