New to Kendo UI for jQueryStart a free 30-day trial

Handling UnmaskOnPost(true) Behavior in MaskedTextBox Inside AJAX Grid Editing

Updated on Feb 25, 2026

Environment

ProductMaskedTextBox for UI for ASP.NET MVC,
Grid for UI for ASP.NET MVC
Version2026.1.212

Description

When using the MaskedTextBox component inside a Grid with AJAX editing in Kendo UI for ASP.NET MVC, the .UnmaskOnPost(true) configuration does not automatically remove the mask characters before submitting the value to the server. This behavior occurs because the unmasking functionality applies only when the MaskedTextBox is inside a standard HTML form.

For AJAX scenarios, such as Grid inline or popup editing, the masked value is sent to the server unless manual intervention is implemented.

This knowledge base article also answers the following questions:

  • How to send unmasked values with MaskedTextBox inside a Kendo Grid?
  • Why does .UnmaskOnPost(true) not work in AJAX editing scenarios?
  • How to ensure the server receives raw values from MaskedTextBox?

Solution

To ensure the server receives the unmasked value, handle the Grid's Save event and manually assign the raw value of the MaskedTextBox to the model.

  1. Define a JavaScript function to handle the Grid's Save event.
javascript
function onSave(e) {
    var maskedtextbox = $("#celular").data("kendoMaskedTextBox");
    if (maskedtextbox) {
        e.model.celular = maskedtextbox.rawValue();
    }
}
  1. Attach the Save event handler to your Grid configuration.
csharp
@(Html.Kendo().Grid<Model>()
    .Name("Grid")
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Events(events => events.Save("onSave"))
    // ... other grid configuration ...
)

This approach ensures the raw, unmasked value from the MaskedTextBox is assigned to the model before it is sent to the server.

See Also