2011-09-22 95 views
2

我在asp.net web表單中使用了Recaptcha控件。而且我面臨着有關ErrorMessage的問題。如何:Recaptcha ErrorMessage

  • 爲它設置ErrorMessage?
  • 如果Recaptcha(不是)有效,顯示(隱藏)ErrorMessage?

回答

3

如果您抓住最新的源代碼,您應該在dotnet/test文件夾中找到示例。

的ErrorMessage可以通過CustomTranslations財產喜歡這裏進行設置: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; 

    } 

的的ErrorMessage會因爲RecaptchaControl實現IValidator接口自動顯示在的ValidationSummary。

+0

如果我有一個ValidationSummary?無論我在incorrect_try_again中寫什麼,它都會以英文顯示錯誤信息! –

+1

此問題在此處解決:http://code.google.com/p/recaptcha/issues/detail?id=105您將需要構建最新源代碼 –