부분 뷰 (아래)가있는 MVC 앱이 있습니다. Html.EnableClientValidation()을 추가하면 필드가 종료 될 때 필드가 사라집니다. 누구든지 코드에서 알아낼 것으로 기대하지는 않습니다.하지만 누군가가 그러한 행동을 보았고 올바른 방향으로 나를 가리킬 수 있다면, 고맙겠습니다. 그 동안 나는 한 장씩 재건을 시작하고 내가 볼 수있는 것을보고 다시보고 할 것이다.EnableClientValidation으로 인해 필드가 사라집니다.
감사합니다.
<%= Html.ValidationSummary() %>
<% Html.EnableClientValidation(); // IMPORTANT: this line MUST be *before* Html.BeginForm() block %>
<% using (Ajax.BeginForm("Save", "Items", new AjaxOptions { HttpMethod = "post", InsertionMode = InsertionMode.Replace, UpdateTargetId = "ItemPane"})){%>
<%=Html.AntiForgeryToken()%>
<%=Html.Hidden("Item.Id", (ViewData.Model.Item != null) ? ViewData.Model.Item.Id : Guid.Empty)%>
<!--more hidden items elided-->
<table> <!--yes, I know it should be divs-->
<tr>
<td rowspan="2" width="400px">
<div class="formarea">
<fieldset>
<ol>
<li>
<label id="Item_Label"><%= (ViewData.Model != null && ViewData.Model.Item != null) ? String.Format("Item Number {0} v. {1}", ViewData.Model.Item.ItemNumber, ViewData.Model.Item.Iteration) : "New Item" %></label>
</li>
<li>
<label for="Item_Prompt" class="formLabel">Directions:</label>
<%=Html.TextAreaFor(t => t.Item.Directions, 3, 50, new { @class = "text2000", @maxlength = "2000" })%>
<%= Html.ValidationMessageFor(t => t.Item.Directions, "*")%>
</li>
<li>
<label for="Item_Prompt" class="formLabel">Prompt:</label>
<%= Html.TextBoxFor(model => model.Item.Prompt, new { @class = "text200", @maxlength = "200" })%>
<%= Html.ValidationMessageFor(model => model.Item.Prompt, "*")%>
</li>
I가 다음 스크립트 참조 :
<%= Html.Script("~/Scripts/MicrosoftAjax.debug.js") %>
<%= Html.Script("~/Scripts/MicrosoftMvcAjax.debug.js") %>
<%= Html.Script("~/Scripts/jquery-1.4.2.min.js") %>
<%= Html.Script("~/Scripts/jquery-ui-1.8.2.custom.min.js") %>
<%= Html.Script("~/Scripts/jquery.form.js") %>
<%= Html.Script("~/Scripts/MicrosoftMvcValidation.js") %>
참고 바랍니다 문제가 해결됩니다 : 이것은 Html.BeginForm() 또는 Ajax.BeginForm를 사용하는지 여부 일() – sydneyos