我的弹出窗口出现,当TextBox为空时,必须在弹出窗口中显示必需的消息,但它不会出现。我使用DataAnnotaion
这是我的观看代码:
@model BLL.Boards
@{
AjaxOptions ajaxOptions = new AjaxOptions
{
UpdateTargetId = "Board_list",
LoadingElementId = "loading",
LoadingElementDuration = 1000,
OnComplete = "closeDialog('Board')"
};
}
<fieldset>
<legend>Boards List</legend>
@using (Ajax.BeginForm("Edit", ajaxOptions))
{
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.BoardID)
<table>
<tr>
<td>@Html.LabelFor(model => model.BoardName)</td>
<td>@Html.EditorFor(model => model.BoardName)</td>
<td>@Html.ValidationMessageFor(model => model.BoardName)</td>
</tr>
<tr>
<td>@Html.LabelFor(model => model.BoardDescription)</td>
<td>@Html.EditorFor(model => model.BoardDescription)</td>
<td>@Html.ValidationMessageFor(model => model.BoardDescription)</td>
</tr>
</table>
<input type="submit" class="btn btn-primary" value="Save" />
<input type="button" class="btn btn-primary" value="Cancel"/>
}
</fieldset>