Question

I am using Telerik captcha control without textbox and now i want to validate this with my own textbox value.

my code is this

<telerik:RadCaptcha ID="RadCaptcha" runat="server" EnableRefreshImage="true" CaptchaTextBoxCssClass="text"
                                                                ProtectionMode="Captcha" Display="Dynamic" ErrorMessage="Invaid Code" CaptchaImage-TextColor="Black"
                                                                CaptchaImage-RenderImageOnly="true" CaptchaImage-Width="219" CaptchaImage-TextChars="CustomCharSet"
                                                                CaptchaImage-CharSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
                                                                CaptchaImage-ImageCssClass="captchIMG" CaptchaImage-Height="36" CaptchaImage-BackgroundNoise="None"
                                                                CaptchaImage-LineNoise="High" />

and a single seperate text box for validate its value

<asp:TextBox ID="txtCaptcha" runat="server" CssClass="text" />

Now on button click event i want to validate this captcha text but how???

Was it helpful?

Solution

Please follow these suggestions in order to achieve the desired functionality:

  1. The property ValidationGroup of the RadCaptcha and the button, that triggers postback, should have the same value.

  2. The ValidatedTextBoxID property of RadCaptcha should be set to the ID of the TextBox which you want to be validated. This is demonstrated in the following online demo: http://demos.telerik.com/aspnet-ajax/captcha/examples/refreshimage/defaultcs.aspx.

  3. In the button's click event handler, you can use the IsValid property of RadCapthca to validate the input for the captcha. In this online demo you can check a scenario, in which the IsValid property is used.

I would also suggest the Getting Started help article, which contains useful information on utilizing the RadCapthca control.

OTHER TIPS

There is a demo on the Telerik site that shows how to use an external textbox to validate the captcha - http://demos.telerik.com/aspnet-ajax/captcha/examples/refreshimage/defaultcs.aspx I think you will be able to use its code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top