我想解決客戶端驗證,並遵循了幾個教程,它看起來很簡單,但我不知道爲什麼它不在我的項目上工作,下面是代碼:Html.ClientValidation does not work on mvc
<script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="/Scripts/jquery.validate.js"></script>
<script type="text/javascript" src="/Scripts/MicrosoftMvcJQueryValidation.js"></script>
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary("Please Correct the errors and try again")%>
<div class="editor-label">
<%: Html.LabelFor(model => model.test,"Test") %>
</div>
</td>
<td>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.test)%>
<%: Html.ValidationMessageFor(model => model.test)%>
</div>
</td>
</tr>
編輯: 母版頁
<script type="text/javascript" src="<%= Url.Content("~/scripts/jquery-1.5.1.js") %>"></script>
<script type="text/javascript" src="<%= Url.Content("~/scripts/jquery.validate.js") %>"></script>
<script type="text/javascript" src="<%= Url.Content("~/scripts/jquery.validate.unobtrusive.js") %>"> </script>
<script src="/Scripts/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/Scripts/tiny_mce/jquery.tinymce.js"></script>
<script src="/Scripts/ie6.js" type="text/javascript"></script>
爲什麼當我按標籤該字段的客戶端驗證犯規工作任何想法。
這是ASP.NET MVC 3嗎? –
你好,但我沒有使用剃鬚刀引擎 –
我也嘗試了腳本的url.content,但是這樣做的工作.. –