ASP.NET MVC3 - textarea with @Html.EditorFor

后端 未结 4 628
猫巷女王i
猫巷女王i 2020-12-12 10:31

I have ASP.NET MVC3 app and I have also form for add news. When VS2010 created default view I have only text inputs for string data, but I want to have textarea for news tex

4条回答
  •  暖寄归人
    2020-12-12 10:49

    Declare in your Model with

      [DataType(DataType.MultilineText)]
      public string urString { get; set; }
    

    Then in .cshtml can make use of editor as below. you can make use of @cols and @rows for TextArea size

         @Html.EditorFor(model => model.urString, new { htmlAttributes = new { @class = "",@cols = 35, @rows = 3 } })
    

    Thanks !

提交回复
热议问题