asp.net-mvc-4 – 在asp .net mvc 4中使用htmlhelper创建textare
发布时间:2020-12-16 09:24:03 所属栏目:asp.Net 来源:网络整理
导读:使用:ASP .NET MVC 4 在我的一个页面中,我需要一个具有一定宽度和高度的textarea,使用html helper类.我的一些代码如下: div class="editor-label" @Html.LabelFor(model = model.MailSubject) /div div class="editor-field" @Html.EditorFor(model = mode
使用:ASP .NET MVC 4
在我的一个页面中,我需要一个具有一定宽度和高度的textarea,使用html helper类.我的一些代码如下: <div class="editor-label"> @Html.LabelFor(model => model.MailSubject) </div> <div class="editor-field"> @Html.EditorFor(model => model.MailSubject) @Html.ValidationMessageFor(model => model.MailSubject) </div> <div class="editor-label"> @Html.LabelFor(model => model.MailBody) </div> <div class="editor-field"> @Html.EditorFor(model => model.MailBody) @Html.ValidationMessageFor(model => model.MailBody) </div> <div class="editor-label"> @Html.LabelFor(model => model.Content) </div> <div class="editor-field1"> @Html.EditorFor(model => model.Content) @Html.ValidationMessageFor(model => model.Content) </div> 我想知道如何定义editorfor(model.content)的大小(宽度/隐藏)? 解决方法
我意识到这个问题已经超过一年了,但万一有人正在寻找答案,这里是:
Html.TextAreaFor(model => model.Field,new { rows = "",cols = "",style = "width: 90%; height: 50px;" }) 您可以内联应用样式或使用类声明.这将在页面上呈现textarea,如下所示: <textarea class="swiper-no-swiping" name="model.Field" cols="" rows="" style="width: 90%; height: 50px;"></textarea> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读