我的 asp.net mvc Web 应用程序中有以下主视图:-
<table>
<tr>
<th>
Lab Test
</th>
<th>
Result
</th>
<th>
Date Taken
</th>
<th>
Comment
</th>
<th>
</th>
@for (int item = 0; item < 10; item++)
{
using (Ajax.BeginForm("CreateAll", "VisitLabResult", new AjaxOptions
{
HttpMethod = "Post",
UpdateTargetId = item.ToString(),
InsertionMode = InsertionMode.Replace,
OnSuccess = string.Format(
"disableform({0})",
Json.Encode(item)),
}))
{ <tr id = "@item">
@Html.Partial("_create",Model)
</tr>
}
} </table>
它呈现以下 _create 部分视图:- @section 脚本{
}
<td>
@Html.DropDownList("LabTestID", String.Empty)
@Html.ValidationMessageFor(model => model.LabTestID)
</td>
<td>
@Html.EditorFor(model => model.Result)
@Html.ValidationMessageFor(model => model.Result)
</td>
<td>
@Html.EditorFor(model => model.DateTaken)
@Html.ValidationMessageFor(model => model.DateTaken)
</td>
<td>
@Html.EditorFor(model => model.Comment)
@Html.ValidationMessageFor(model => model.Comment)
</td>
<td>
<input type= "hidden" name = "visitid" value = "@ViewBag.visitid" />
<input type="submit" value="Create" />
</td>
目前,使用 firefox 或 chrome 时,所有数据注释客户端验证(如 Required)都不会显示,但它们会在使用 IE9 时正常工作,所以可能是什么问题。BR