开发者

How can I reload ReCaptcha control after custom validation?

I have ReCaptcha control on my registration form:

<recaptcha:RecaptchaControl ID="ReCaptcha" runat="server" PublicKey="<%$ appSettings:ReCaptchaPublicKey %>" PrivateKey="<%$ appSettings:ReCaptchaPrivateKey %>" Theme="white" />
<asp:CustomValidator ID="ReCaptchaCustomValidator" runat="server" ErrorMessage="ReCaptcha error message." Display="None" ValidationGroup="Step1" EnableClientScript="true" OnServerValidate="ReCaptcha_ServerValidate" />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" ValidationGroup="Step1" CssClass="validationSummary" />

CodeBehind

protected void Re开发者_高级运维Captcha_ServerValidate(object source, ServerValidateEventArgs e)
    {
        ReCaptcha.Validate();

        if (ReCaptcha.IsValid)
            e.IsValid = true;

        else
            e.IsValid = false;
    }

If user enter ReCaptcha value not properly, ReCaptcha control disappear after server-side validation.

How can I reload it after validation?


protected void Page_PreRender(object sender, EventArgs e)

{

CaptchaControl1.Enabled = true;

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜