如何在 Asp.net mvc.I 中更改 Html.EditFor 的高度已尝试使用 jQuery。但失败了
How to change the height for Html.EditFor in Asp.net mvc.I've tried using jQuery .But failed
我一直在努力 asp.net mvc.I 运行 到 problem.I 有一个 multiline.I 的文本框想增加它的 height.I已经尝试使用@html.raw 方法并且还尝试在 Html.EditFor.Nothing worked.So 中使用 new{styles:} 添加内联样式,我该怎么做?这是我的视图
@model CTCFremont.Models.eMail
@{
ViewBag.Title = "Create";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script>
$(document).ready(function () {
$("#PrayerRequest").css("height", 300);
$("#PrayerRequest").css("width", 200);
});
</script>
<h2>Submit Your Prayer Request</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>eMail</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Email)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Email)
@Html.ValidationMessageFor(model => model.Email)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Request)
</div>
<div class="editor-field" >
@Html.EditorFor(model => model.Request,Html.Id("PrayerRequest"))
@Html.ValidationMessageFor(model => model.Request)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
让我知道如何处理这个..
不确定要为哪个编辑器使用文本区域,但只需使用如下代码在 CSS 样式中指定高度。
@Html.TextAreaFor(x => x.Request, new {@style = "height: 30px;"})
我一直在努力 asp.net mvc.I 运行 到 problem.I 有一个 multiline.I 的文本框想增加它的 height.I已经尝试使用@html.raw 方法并且还尝试在 Html.EditFor.Nothing worked.So 中使用 new{styles:} 添加内联样式,我该怎么做?这是我的视图
@model CTCFremont.Models.eMail
@{
ViewBag.Title = "Create";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script>
$(document).ready(function () {
$("#PrayerRequest").css("height", 300);
$("#PrayerRequest").css("width", 200);
});
</script>
<h2>Submit Your Prayer Request</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>eMail</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Email)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Email)
@Html.ValidationMessageFor(model => model.Email)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Request)
</div>
<div class="editor-field" >
@Html.EditorFor(model => model.Request,Html.Id("PrayerRequest"))
@Html.ValidationMessageFor(model => model.Request)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
让我知道如何处理这个..
不确定要为哪个编辑器使用文本区域,但只需使用如下代码在 CSS 样式中指定高度。
@Html.TextAreaFor(x => x.Request, new {@style = "height: 30px;"})