解决方法
您可以使用
[DataType(DataType.MultilineText)]
属性来装饰模型属性:
模型:
public class MyModel { [DataType(DataType.MultilineText)] public string MyProperty { get; set; } }
控制器:
public class HomeController : Controller { public ActionResult Index() { return View(new MyModel()); } }
视图:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SomeNs.Models.MyModel>" %> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <%: Html.EditorForModel() %> </asp:Content>