Js触发ASP.NET Validation控件的验证, 同时获取前台验证结果(不包括CustomValidator)

function CallValidate(group) {
if (typeof (Page_ClientValidate) == "function") {
Page_BlockSubmit = false;
if (Page_ClientValidate(group)) {
return true;
} else {
var results = "";
var ids = "";
var validators = $(Page_Validators);
$(validators).each(function (index, element) {
var controlToValid = jQuery.find("#" + $(element).attr("controltovalidate"));
if (controlToValid != null) {
results += $(element).attr("isvalid").toString();
ids += $(element).attr("controltovalidate").toString();
if (index != validators.length - 1) {
results += ',';
ids += ',';
}
}
});
//这里你可以根据获取到的id和result作一些处理
//不过, 这里不包括Customs的Validation的
return false;
}
}
}
上一篇:mysql创建新用户出现错误处理


下一篇:javascript获取asp.net服务器端控件的值