asp.net-mvc – 如何使用EditorForModel()来装饰我的ASP.NET MVC
发布时间:2020-12-16 00:31:11 所属栏目:asp.Net 来源:网络整理
导读:当使用EditorForModel()时,如何将ASP.NET MVC ViewModel属性装饰为textarea 解决方法 您可以使用 [DataType(DataType.MultilineText)] 属性来装饰模型属性: 模型: public class MyModel{ [DataType(DataType.MultilineText)] public string MyProperty {
当使用EditorForModel()时,如何将ASP.NET MVC ViewModel属性装饰为textarea
解决方法
您可以使用
[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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc-3 – “添加区域”未出现在visual studio 2010
- asp.net – 找出合适的工作语言:从C#分支出来
- asp.net-mvc – asp.net mvc数据注释的默认值
- 在ASP.NET MVC中模拟User.Identity
- ASP.NET MVC错误处理 – 删除aspxerrorpath
- asp.net-mvc – ASP.Net MVC路由遗传URL将查询字符串ID传递
- asp.net-mvc – 以下多租户应用程序示例(MVC Ninject)
- 在servicestack中使用asp.net身份验证
- 也谈事件(Event)
- asp.net-mvc – 无法安装Asp.net MVC 3