开发者

How to add css class?

开发者 https://www.devze.com 2023-02-09 08:15 出处:网络
@Html.EditorFor(model => model.Screen.Descri开发者_如何学Cption) How to add a class or some other attributes to the generated input?The built-in editor template is too generic (it can display arb
@Html.EditorFor(model => model.Screen.Descri开发者_如何学Cption)

How to add a class or some other attributes to the generated input?


The built-in editor template is too generic (it can display arbitrary objects) for such a concept to make sense. You could either

  1. Write your own editor template
  2. If it's only a single property you're displaying you could use a more specific helper method such as Html.TextBoxFor():

    @Html.TextBoxForm(m => m.Screen.Description, new { @class = "myClass" })
    
0

精彩评论

暂无评论...
验证码 换一张
取 消