我的问题是,当我修改密码的值时,我有一个输入密码,它有一个 custumValidator 我检查密码是否不包含名称。当我还编辑字段名称时,我需要触发相同的 customvalidator(客户端验证):我该怎么做:
<form id="Form1" runat="server">
<h3>CustomValidator ServerValidate Example</h3>
<asp:Label id="Message"
Text="Enter an even number:"
Font-Name="Verdana"
Font-Size="10pt"
runat="server"/>
<p>
<asp:TextBox id="name"
runat="server" />
<asp:TextBox id="password"
runat="server" />
<asp:CustomValidator id="CustomValidator1"
ControlToValidate="password"
ClientValidationFunction="ClientValidate"
OnServerValidate="ServerValidation"
Display="Static"
ErrorMessage="Not an even number!"
ForeColor="green"
Font-Name="verdana"
Font-Size="10pt"
runat="server"/>
<p>
<asp:Button id="Button1"
Text="Validate"
OnClick="ValidateBtn_OnClick"
runat="server"/>
</form>
</body>
</html>
<script language="javascript">
function ClientValidate(source, arguments)
{
// here i will implement :if source contains name
arguments.IsValid = true;
else {
arguments.IsValid = false;
}
}
</script>