New to Telerik UI for ASP.NET Core? Download free 30-day trial

CaptchaBuilder

Properties

WriteAction - Func

Methods

CaptchaImage(System.String)

Specifies the source of an image to be rendered in the Captcha initially. If the option is not defined, the handler that resets the image will be called.

Parameters

captchaImage - System.String

The value that configures the image.

Example


                @(Html.Kendo().Captcha()
                   .Name("captcha")
                   .CaptchaImage((string)ViewData["CaptchaImage"])
                   .DataCaptchaField("Captcha")
                   .DataCaptchaIdField("CaptchaID")
                   .Handler(handler => handler.Action("Reset", "Captcha"))
                )

AudioHandler(System.Action)

The URL or AJAX settings that fetches the audio of the captcha.

Parameters

configurator - System.Action<CrudOperationBuilder>

The action that configures the audio settings.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .AudioHandler(x => x.Action("GetAudio","Captcha").Data("additionalParameters"))
             )

AudioHandler(System.String)

Defines the URL that fetches the audio of the captcha.

Parameters

url - System.String

The URL that returns the audio source.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .AudioHandler("url-to-audio")
             )

AudioHandlerFunction(System.String)

The JavaScript function that fetches the audio of the captcha. Within the function, call the "args.success" method with the source of the audio (base64 stream).

Parameters

handler - System.String

The JavaScript function that returns the source of the audio.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .AudioHandlerFunction("audioHandler")
             )
            <script>
                function audioHandler(args) {
                    args.success("@Url.Action("GetAudio", "Captcha")?captchaId=" + args.data.CaptchaID);
                }
            </script>

Handler(System.Action)

Defines the URL or AJAX settings that fetches the captcha image and id. The request triggers initially when the CaptchaImage() and CaptchaId() options are not defined to request the captcha and when the "Reset" button is clicked.

Parameters

configurator - System.Action<CrudOperationBuilder>

The action that configures the endpoint to return the image initially or when resetting the Captcha.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .Handler(handler => handler.Action("GetCaptcha", "Captcha").Data("additionalParameters"))
             )

Handler(System.String)

Defines the URL that fetches the captcha image and id.

Parameters

url - System.String

The URL that returns the captcha image and id.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .Handler("url-to-captcha")
             )

HandlerFunction(System.String)

The JavaScript function that fetches the captcha image and id. Within the function, call the "args.success()" method with the received captcha image and id.

Parameters

handler - System.String

The JavaScript function that returns the captcha image and id.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .DataCaptchaField("Captcha")
                 .DataCaptchaIdField("CaptchaID")
                 .HandlerFunction("getCaptcha")
             )
            <script>
                function getCaptcha(args) {
                  $.ajax({
                    type: "GET",
                    url: '@Url.Action("Reset","Captcha")',
                    success: function(data) {
                      args.success({
                        Captcha: data.Captcha,
                        CaptchaID: data.CaptchaID
                      });
                    }
                  });
                }
            </script>

ValidationHandler(System.Action)

Defines the URL or AJAX settings that validates the text input of the Captcha.

Parameters

configurator - System.Action<CrudOperationBuilder>

The action that configures the validation of the Captcha.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .ValidationHandler(handler => handler.Action("ValidateCaptcha", "Captcha"))
             )

ValidationHandler(System.String)

Defines the URL of the endpoint that validates the text input of the Captcha.

Parameters

url - System.String

The URL of the endpoint.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .ValidationHandler("url-to-validate-captcha")
             )

ValidationHandlerFunction(System.String)

The JavaScript function that validates the text input of the Captcha. Within the function, call the "args.success()" method with the boolean value indicating whether the validation passed successfully.

Parameters

handler - System.String

The JavaScript function that validates the Captcha.

Example


             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .DataCaptchaField("Captcha")
                 .DataCaptchaIdField("CaptchaID")
                 .ValidationHandlerFunction("validateCaptcha")
             )
            <script>
                function validateCaptcha(args) {
                  $.ajax({
                    type: "GET",
                    url: `captcha/validate?CaptchaID=${args.data.CaptchaID}&Captcha=${args.data.Captcha}`,
                    success: function(result) {
                      args.success(result);
                    }
                  });
                }
            </script>

AudioButton(System.Boolean)

Toggles the audio button.

Parameters

value - System.Boolean

The value for AudioButton

CaptchaId(System.String)

The ID of the captcha to be added to the hidden input initially. If not set the handler to reset the ID will be called.

Parameters

value - System.String

The value for CaptchaId

DataCaptchaField(System.String)

The field that returns the captcha's image source. Used in the handler function/response that resets the captcha's image and id.

Parameters

value - System.String

The value for DataCaptchaField

DataCaptchaIdField(System.String)

The field that returns the captcha's id. Used in the handler function/response that resets the captcha's image and id.

Parameters

value - System.String

The value for DataCaptchaIdField

Messages(System.Action)

Provides configuration options for the messages present in the Captcha widget.

Parameters

configurator - System.Action<CaptchaMessagesSettingsBuilder>

The configurator for the messages setting.

ResetButton(System.Boolean)

Toggles the reset button.

Parameters

value - System.Boolean

The value for ResetButton

ValidateOnBlur(System.Boolean)

Whether to trigger validation when input is blurred. This option is useful if you are not using the Kendo Validator or the Kendo Form widgets as it enables to automatically trigger remote validation and use the widet's API in custom validation scenario.

Parameters

value - System.Boolean

The value for ValidateOnBlur

ValidateOnBlur()

Whether to trigger validation when input is blurred. This option is useful if you are not using the Kendo Validator or the Kendo Form widgets as it enables to automatically trigger remote validation and use the widet's API in custom validation scenario.

VolumeControl(System.Boolean)

Whether to show a volume control when audio is played.

Parameters

value - System.Boolean

The value for VolumeControl

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<CaptchaEventBuilder>

The client events action.

Example


            @(Html.Kendo().Captcha()
                  .Name("Captcha")
                  .Events(events => events
                      .Change("onChange")
                  )
            )

ToComponent()

Returns the internal view component.

Expression(System.String)

Sets the name of the component.

Parameters

modelExpression - System.String

Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)

Sets the name of the component.

Parameters

modelExplorer - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name.

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with

Parameters

deferred - System.Boolean

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The HTML attributes.

Render()

Renders the component in place.

ToHtmlString()

WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

Parameters

writer - System.IO.TextWriter
encoder - System.Text.Encodings.Web.HtmlEncoder

ToClientTemplate()

AsChildComponent()

Configures the widget as a child component.

In this article
Not finding the help you need?