我返回局部視圖如何使客戶端驗證在MVC2
public virtual PartialViewResult Create()
{
return PartialView("Create");
}
,並點擊使用jQuery創建按鈕時,裝在我的頁面視圖
function createVendor() {
jQuery.ajax({
type: 'GET',
url: 'Vendor/create',
success: function (result) {
$("#popup").html(result).fadeOut('slow').fadeIn('slow');
}
});
}
在我的課,我使用驗證DataAnnotations,使得對js文件引用,並添加添加
<% Html.EnableClientValidation(); %>
開始之前形成。
問題是,當我點擊保存錯誤的數據第一次驗證不工作,但它是第二次工作,我點擊保存。
我已經將它添加到了我的部分視圖和我的頁面中,我正在加載部分視圖,並且驗證仍然僅在第二次運行。 – Mazen 2010-07-08 08:29:46