如何用验证控件验证复选框的状态
注册页面上,如何用asp.net2.0验证控件来验证是否已经勾选同意协议复选框呢,请赐教
------解决方案--------------------用CustomValidator,自定义一个方法即可。
------解决方案-------------------- <script type= "text/javascript " language= "javascript ">
function isChecked(oSrc,args)
{
args.IsValid=(document.all.boxProtocol.checked);
}
</script>
<asp:CustomValidator ID= "CustomValidator1 " runat= "server " Display= "Dynamic " ErrorMessage= "请选择 " ValidationGroup= "reg " ClientValidationFunction= "isChecked ">
</asp:CustomValidator>