Alexandre
Alexandre

Reputation: 13318

Recaptcha ErrorMessage

I'm using the Recaptcha control in asp.net web forms. And i've faced with the problem about ErrorMessage. How to:

Upvotes: 2

Views: 1478

Answers (1)

Valentin Zberea
Valentin Zberea

Reputation: 11

If you grab the latest source code you should find examples in dotnet/test folder.

ErrorMessage can be set through CustomTranslations property like here: recaptcha-plugins/dotnet/test/CustomTranslation.aspx.cs

    protected void Page_Init(object sender, EventArgs e)
    {

        var customTranslation = new Dictionary<string, string>();
        customTranslation.Add("instructions_visual", "Scrivi le due parole:");
        customTranslation.Add("incorrect_try_again", "Scorretto. Riprova.");

        RecaptchaControl.CustomTranslations = customTranslation;

    }

The ErrorMessage will be automatically displayed in a ValidationSummary because RecaptchaControl implements IValidator interface.

Upvotes: 3

Related Questions