使用CustomValidate自定义验证控件
添加控件:
<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidateDropQY"
ControlToValidate="dropqy" Display="Dynamic" ErrorMessage="此处有错误" ValidationGroup="val"></asp:CustomValidator>
添加JS:
function ValidateDropQY(source, args) {
if (args.Value == "--请选择区域--" || args.Value == "0") {
args.IsValid = false;
}
else {
args.IsValid = true;
}
}