유효성 검사기가 작동하지 않습니다. 도와주세요! 사전에 감사 ...ASP.NET 필수 필드 검사기 및 비교기 유효하지 않음
if (rfvEmail.IsValid && rfvLoginName.IsValid && rfvNewPassword.IsValid
&& rfvConfirmPassword.IsValid && cvComparePasswords.IsValid)
{
DataSet ds = new DataSet();
myDal.ClearParams();
myDal.AddParam("@EmailAddress", txtEmail.Text);
myDal.AddParam("@LoginName", txtLoginName.Text);
myDal.AddParam("@NewLoginPassword", txtNewPassword.Text);
ds = myDal.ExecuteProcedure("spResetPassword");
lblPasswordMessage.Text = ds.Tables[0].Rows[0]["result"].ToString();
}
소스 코드는 다음과 같습니다 : 나는 또한 버튼 내가 저장 버튼의 컨트롤을 검증하기 위해 노력하고있어
<asp:RequiredFieldValidator
ID="rfvConfirmPassword"
runat="server"
ErrorMessage="Password Confirmation is required!"
ControlToValidate="txtConfirmPassword"
EnableClientScript="False"
ForeColor="Red"></asp:RequiredFieldValidator>
<asp:CompareValidator
ID="cvComparePasswords"
runat="server"
ControlToCompare="txtNewPassword"
ControlToValidate="txtConfirmPassword"
EnableClientScript="false"
ForeColor="Red"
ErrorMessage="Passwords entered by you do not match!">
</asp:CompareValidator>
을 true로 CausesValidation를 설정 한 :
protected void btnSavePassword_Click(object sender, EventArgs e)
{
rfvEmail.Validate();
rfvLoginName.Validate();
rfvNewPassword.Validate();
cvComparePasswords.Validate();
resetPassword();
}
, 즉 HTML 부분을 : 여기
내가 어떻게 할 것입니다? – entropic
어디서나 Page.Validate()를 호출합니까? – Dai
저장 단추에서 Page.Validate를 호출했지만 도움이되지 않습니다. – Nupur