CaptchaBuilder
Methods
AudioButton(System.Boolean)
Toggles the audio button.
Parameters
value - System.Boolean
The value that configures the visibility of the audio button.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.AudioButton(false)
)
CaptchaId(System.String)
Defines the ID of the captcha that initially must be displayed. The ID will be stored in the hidden input. If the CaptchaId() is not set, the Handler() option will initiate a request to the remote endpoint to retrieve the captcha ID.
Parameters
value - System.String
The value that configures the captcha ID.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.CaptchaId((string)ViewData["CaptchaID"])
)
DataCaptchaField(System.String)
Sets the name of the field that holds the captcha's image source. It is used in the Handler() option that resets the captcha's image and ID.
Parameters
value - System.String
The value that configures the DataCaptchaField.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.DataCaptchaField("CaptchaImage")
)
DataCaptchaIdField(System.String)
Sets the name of the field that holds the captcha's ID. It is used in the Handler() option that resets the captcha's image and ID.
Parameters
value - System.String
The value that configures the DataCaptchaIdField.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.DataCaptchaIdField("CaptchaID")
)
Messages(System.Action)
Defines the localization of the texts that are used in the Captcha.
Parameters
configurator - System.Action<CaptchaMessagesSettingsBuilder>
The action that configures the messages settings.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.Messages(msg => msg.Success("Successful Verification").Audio("Play captcha"))
)
ResetButton(System.Boolean)
Toggles the reset button.
Parameters
value - System.Boolean
The value that configures the visibility of the reset button.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.ResetButton(false)
)
ValidateOnBlur(System.Boolean)
Defines whether to trigger the validation when the input is blurred. This option is useful when the Kendo UI Validator or the Telerik UI Form are not used, as it automatically triggers the remote validation.
Parameters
value - System.Boolean
The value that enables the validation on blur.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.ValidateOnBlur(true)
)
VolumeControl(System.Boolean)
Toggles the volume control button when the audio is played.
Parameters
value - System.Boolean
The value that configures the visibility of the volume control button.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.VolumeControl(false)
)
CaptchaImage(System.String)
Defines the image source that initially must be rendered as captcha. If the CaptchaImage() is not set, the Handler() option will initiate a request to the remote endpoint to retrieve the image.
Parameters
captchaImage - System.String
The value that configures the initial image.
Example
@(Html.Kendo().Captcha()
.Name("captcha")
.CaptchaImage((string)ViewData["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>
Events(System.Action)
Handles the client-side events of the Captcha.
Parameters
configurator - System.Action<CaptchaEventBuilder>
The action that configures the available events.
Example
@( Html.Kendo().Captcha()
.Name("captcha")
.Events(events => events.Change("onChange"))
)
ToComponent()
Returns the internal view component.
Name(System.String)
Sets the name of the component.
Parameters
componentName - System.String
The name of the component.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Deferred(System.Boolean)
Suppress initialization script rendering. Note that this options should be used in conjunction with
Parameters
deferred - System.Boolean
ModelMetadata(System.Web.Mvc.ModelMetadata)
Uses the Metadata of the Model.
Parameters
modelMetadata - System.Web.Mvc.ModelMetadata
The metadata set for the Model
HtmlAttributes(System.Object)
Sets the HTML attributes.
Parameters
attributes - System.Object
The HTML attributes.
HtmlAttributes(System.Collections.Generic.IDictionary)
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
AsModule(System.Boolean)
Specifies whether the initialization script of the component will be rendered as a JavaScript module.
Parameters
value - System.Boolean
Render()
Renders the component.
Example
@(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
@( Html.Kendo().Grid(Model)
.Name("grid")
.DetailTemplate(product => {
)
Product Details:
<div>Product Name: @( product.ProductName )</div>
<div>Units In Stock: @( product.UnitsInStock )</div>
@(
})
.Render();
)
ScriptAttributes(System.Object,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Object
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.
ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.