How do I specify the columns and rows of a multiline Editor-For in ASP.MVC?

后端 未结 7 2010
梦毁少年i
梦毁少年i 2020-12-08 12:42

In ASP.MVC 3, how do I specify the columns and rows for a multiline EditorFor (textarea)? I am using [UIHint(\"MultilineText\")], but can\'t find a

7条回答
  •  执念已碎
    2020-12-08 13:36

    One option seems to be using CSS to style the textarea

    .multi-line { height:5em; width:5em; }
    

    See this entry on SO or this one.

    Amurra's accepted answer seems to imply this class is added automatically when using EditorFor but you'd have to verify this.

    EDIT: Confirmed, it does. So yes, if you want to use EditorFor, using this CSS style does what you're looking for.