.NET MVC - How to assign a class to Html.LabelFor?

后端 未结 3 411
刺人心
刺人心 2021-01-31 01:08

This code

<%= Html.LabelFor(model => model.Name) %>

produces this


         


        
3条回答
  •  半阙折子戏
    2021-01-31 01:59

    Okay, looking at the source (System.Web.Mvc.Html.LabelExtensions.cs) for this method, there doesn't seem to be a way to do this with an HtmlHelper in ASP.NET MVC 2. I think your best bet is to either create your own HtmlHelper or do the following for this specific label:

    
    

提交回复
热议问题