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

MaskedTextBoxBuilder

Methods

Value(System.String)

Sets the initial value of the MaskedTextBox.

Parameters

value - System.String

The value that configures the initial value.

Example


             @(Html.Kendo().MaskedTextBox()
                        .Name("maskedTextBox")
                        .Value("555 123 4567")
            )

UnmaskOnPost(System.Boolean)

Specifies whether the MaskedTextBox will unmask the input value on form post

Parameters

value - System.Boolean

The value that enables the unmasking of the input value.

Example


             @(Html.Kendo().MaskedTextBox()
                .Name("maskedTextBox")
                .UnmaskOnPost(true)
             )

ClearPromptChar(System.Boolean)

Specifies whether the MaskedTextBox will replace the prompt characters with spaces on blur. Prompt chars will be shown again on focus.

Parameters

value - System.Boolean

The value that enables the ClearPromptChar option.

Example


             @(Html.Kendo().MaskedTextBox()
                .Name("maskedTextBox")
                .ClearPromptChar(true)
             )

PromptChar(System.String)

Specifies the character used to represent the absence of user input in the MaskedTextBox.

Parameters

promptChar - System.String

The value that configures the prompt character.

Example


             @(Html.Kendo().MaskedTextBox()
                .Name("maskedTextBox")
                .PromptChar("X")
             )

Events(System.Action)

Configures the handled client-side events of the MaskedTextBox.

Parameters

EventsAction - System.Action<MaskedTextBoxEventBuilder>

The action that configures the available events.

Example


             @( Html.Kendo().MaskedTextBox()
                        .Name("MaskedTextBox")
                        .Events(events =>
                            events.Change("change")
                        )
            )

Rules(System.Action)

Configures the custom mask rules.

Parameters

RulesAction - System.Action<MaskedTextBoxRulesBuilder>

The action that configures the custom mask rules.

Example


             @( Html.Kendo().MaskedTextBox()
                        .Name("MaskedTextBox")
                        .Rules(rules =>
                            rules.Add('~', "/[+-]/")
                        )
            )

Enable(System.Boolean)

Specifies if the MaskedTextBox must be initially enabled or disabled.

Parameters

value - System.Boolean

The value that enables or disables the input.

Example


             @( Html.Kendo().MaskedTextBox()
                  .Name("maskedTextBox")
                  .Enable(false)
            )

Mask(System.String)

Sets the mask of the MaskedTextBox.

Parameters

mask - System.String

The value that configures the mask.

Example


             @(Html.Kendo().MaskedTextBox()
                  .Name("maskedTextBox")
                  .Mask("999 000 000")
             )

Culture(System.String)

Specifies the culture used by the MaskedTextBox.

Parameters

culture - System.String

The value that configures the culture.

Example


             @(Html.Kendo().MaskedTextBox()
                 .Name("maskedTextBox")
                 .Culture("de-DE")
            )

Label(System.Action)

Adds a label before the input. If the input has no 'id' attribute, a generated 'id' will be assigned.

Parameters

configurator - System.Action<MaskedTextBoxLabelSettingsBuilder>

The action that configures the label settings.

Example


             @(Html.Kendo().MaskedTextBox()
                .Name("maskedTextBox")
                .Label(l => l.Content("Phone number").Floating(true))
            )

FillMode(Kendo.Mvc.UI.FillMode)

Sets the way the color is applied to the rendered MaskedTextBox.

Parameters

value - FillMode

The enum value that configures the fill mode.

Example


             @(Html.Kendo().MaskedTextBox()
                  .Name("maskedTextBox")
                  .FillMode(FillMode.Solid)
             )

Rounded(Kendo.Mvc.UI.Rounded)

Parameters

value - Rounded

Size(Kendo.Mvc.UI.ComponentSize)

Sets the size of the MaskedTextBox.

Parameters

value - ComponentSize

The enum value that configures the size.

Example


             @(Html.Kendo().MaskedTextBox()
                   .Name("maskedTextBox")
                   .Size(ComponentSize.Large)
            )

PrefixOptions(System.Action)

Defines the configuration for the prefix adornment of the MaskedTextBox.

Parameters

configurator - System.Action<PrefixOptionsSettingsBuilder>

The action that configures the prefix options.

Example


             @(Html.Kendo().MaskedTextBox()
                   .Name("maskedTextBox")
                   .PrefixOptions(prefix => prefix.Icon("info-solid"))
            )

SuffixOptions(System.Action)

Defines the configuration for the suffix adornment of the MaskedTextBox.

Parameters

configurator - System.Action<SuffixOptionsSettingsBuilder>

The action that configures the suffix options.

Example


             @(Html.Kendo().MaskedTextBox()
                   .Name("maskedTextBox")
                   .SuffixOptions(suffix => suffix.Icon("lock"))
            )

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.

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?