如何用HtmlHelper在ASP.NET MVC 4中优雅地创建长尾词的textarea?

2026-03-30 12:381阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计346个文字,预计阅读时间需要2分钟。

如何用HtmlHelper在ASP.NET MVC 4中优雅地创建长尾词的textarea?

使用ASP.NET MVC 4,在页面中添加具有特定宽度和高度的textarea,可以使用 helper类。以下是一个简化的示例:

@Html.LabelFor(model=> model.MailSubject) @Html.TextAreaFor(model=> model.MailSubject, new { width=300px, height=100px })

使用: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)的大小(宽度/隐藏)?

我意识到这个问题已经超过一年了,但万一有人正在寻找答案,这里是:

如何用HtmlHelper在ASP.NET MVC 4中优雅地创建长尾词的textarea?

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>

本文共计346个文字,预计阅读时间需要2分钟。

如何用HtmlHelper在ASP.NET MVC 4中优雅地创建长尾词的textarea?

使用ASP.NET MVC 4,在页面中添加具有特定宽度和高度的textarea,可以使用 helper类。以下是一个简化的示例:

@Html.LabelFor(model=> model.MailSubject) @Html.TextAreaFor(model=> model.MailSubject, new { width=300px, height=100px })

使用: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)的大小(宽度/隐藏)?

我意识到这个问题已经超过一年了,但万一有人正在寻找答案,这里是:

如何用HtmlHelper在ASP.NET MVC 4中优雅地创建长尾词的textarea?

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>