TitleとNewsContentで検証できない次のビューがあります。タイトルの検証は機能しますが、NewsContentは機能しません。どうすれば修正できますか。
@model Foo.NewsViewModel
@{
ViewBag.Title = "Create";
}
@using (Html.BeginForm("Create", "News", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div>
<fieldset>
<legend>Category Information</legend>
<div class="editor-label">
@Html.LabelFor(m => m.News.Title)
</div>
<div class="editor-field">
@Html.TextBoxFor(m => m.News.Title)
@Html.ValidationMessageFor(m => m.News.Title)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.News.NewsContent)
</div>
<div class="editor-field" id="container">
@Html.TextAreaFor(m => m.News.NewsContent)
@Html.ValidationMessageFor(m => m.News.NewsContent)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.News.Thumbnail)
</div>
<div class="editor-field">
<input type="file" name="files" id="thumbnail" />
</div>
<div class="editor-label">
@Html.LabelFor(m => m.News.Image)
</div>
<div class="editor-field">
<input type="file" name="files" id="original" />
</div>
<div class="editor-label">
@Html.Label("SelectedCategoryId")
</div>
<div class="editor-field">
@Html.DropDownListFor(m => m.SelectedCategoryId, Model.Categories)
</div>
<div class="editor-label">
Publish
</div>
<div class="editor-field">
@Html.CheckBoxFor(m => m.News.Published, new { @checked = "checked" })
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
</div>
}
そしてここにモデルがあります|:
public class News : IStorable
{
[Required]
[Display(Name = "Title")]
public virtual string Title { get; set; }
[Required]
[Display(Name = "Content")]
public virtual string NewsContent { set; get; }
......