4
@Html.EditorFor(model => model.Screen.Description)

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

1 Answer 1

3

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" })
    
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.