asp.net mvc razor - use multiline text.. EditorFor or TextAreaFor- 2 different way same goal -


First way: in model ; add multilinetext propert  to field..
  [DataType(DataType.MultilineText)]
public string Description { get; set; }


Second way: in view ; use TextAreaFor instead EditorFor (* not necessary addin multiline to model.)
  @Html.TextAreaFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })


** my choice is first way ..




Yorumlar