Unplanned
Last Updated: 28 Jul 2026 07:07 by Johannes
Created by: Johannes
Comments: 0
Category: MaskedTextBox
Type: Bug Report
1

The MaskedTextBox caret (cursor) jumps to the last position on focus and every key stroke when the component is inside a Grid EditorTemplate and the Grid EditMode is InCell.

A possible workaround is to use inline or popup editing.

Test Page:

<TelerikGrid Data="@GridData"
             EditMode="@GridEditMode.Incell"
             OnUpdate="@OnGridUpdate"
             OnCreate="@OnGridCreate">
    <GridToolBarTemplate>
        <GridCommandButton Command="Add">Add Item</GridCommandButton>
    </GridToolBarTemplate>
    <GridColumns>
        <GridColumn Field="@nameof(Product.Name)" />
        <GridColumn Field="@nameof(Product.MaskedValue)">
            <EditorTemplate>
                @{ var dataItem = (Product)context; }
                <TelerikMaskedTextBox @bind-Value="@dataItem.MaskedValue"
                                      Mask="AAA-AAA" />
            </EditorTemplate>
        </GridColumn>
    </GridColumns>
</TelerikGrid>

@code {
    private List<Product> GridData { get; set; } = new();

    private int LastId { get; set; }

    private void OnGridCreate(GridCommandEventArgs args)
    {
        var createdItem = (Product)args.Item;

        createdItem.Id = ++LastId;

        GridData.Insert(0, createdItem);
    }

    private void OnGridUpdate(GridCommandEventArgs args)
    {
        var updatedItem = (Product)args.Item;
        var originalItemIndex = GridData.FindIndex(i => i.Id == updatedItem.Id);

        if (originalItemIndex != -1)
        {
            GridData[originalItemIndex] = updatedItem;
        }
    }

    protected override void OnInitialized()
    {
        for (int i = 1; i <= 5; i++)
        {
            GridData.Add(new Product()
            {
                Id = ++LastId,
                Name = $"Product {LastId}",
                MaskedValue = $"ABC-{LastId:D3}"
            });
        }
    }

    public class Product
    {
        public int Id { get; set; }
        public string Name { get; set; } = string.Empty;
        public string MaskedValue { get; set; } = string.Empty;
    }
}

Won't Fix
Last Updated: 06 Jan 2026 15:46 by ADMIN

My users use Tab to focus the masked textbox and when they start typing (its content was highlighted because of getting focus with Tab), that typing action does not put the range (caret) in the correct place - it remains at position 0 rather than going to position 1.

For example, in the below phone mask they type "9" and then "0" and I would expect to get "90" but I get "0".

---

ADMIN EDIT

A workaround is to collapse the range when the input gets focus:

@inject IJSRuntime JsInterop

<input />
<span @onfocusin="@CollapseInputSelection" @ref="@ParentElem">
    <TelerikMaskedTextBox Mask="+1 (000) 000-0000"
                          IncludeLiterals="true"
                          @bind-Value="@CellPhoneNumber"
                          Class="form-control" />
</span>

@* move this script to an actual script file instead of using this hack *@
<script suppress-error="BL9992">
    function collapseInputSelection(root) {
        setTimeout(function () {
            var input = root.querySelector("input");
            if (input) {
                input.setSelectionRange(0, 0);
            }
        }, 20);
    }
</script>

@code{
    string CellPhoneNumber { get; set; }

    ElementReference ParentElem { get; set; }
    async Task CollapseInputSelection()
    {
        await JsInterop.InvokeVoidAsync("collapseInputSelection", ParentElem);
    }
}

---

Completed
Last Updated: 23 May 2025 08:30 by ADMIN
Release 9.0.0
Created by: Frank
Comments: 0
Category: MaskedTextBox
Type: Bug Report
1

When the MaskedTextBox is not focused and has no value, the Floating Label displays over the textbox as expected, however, the mask itself remains visible.

Here is a test example with a CSS workaround:

<TelerikFloatingLabel Text="Floating Label Over Mask">
    <TelerikMaskedTextBox @bind-Value="@MaskedValue"
                          Mask="000-000"
                          Width="200px"
                          Class="mask-with-label" />
</TelerikFloatingLabel>

@if (string.IsNullOrEmpty(MaskedValue))
{
    <style>
        .mask-with-label input:not(:focus) {
            color: transparent;
        }
    </style>
}

@code {
    private string MaskedValue { get; set; } = string.Empty;
}

Unplanned
Last Updated: 20 May 2024 13:23 by Shannon

When the user enters a value, clicks out of the Masked Textbox and then back into it, the cursor is placed at the beginning of the input rather than at the end of the value.

This issue only happens when:

  • The MaskedTextBox does not have a mask specified.
  • The MaskedTextBox does not have an initial value.

Reproduction: https://blazorrepl.telerik.com/meEpmEbR20id24Ss02

Unplanned
Last Updated: 07 Jan 2021 19:46 by ADMIN
Created by: Jason
Comments: 0
Category: MaskedTextBox
Type: Feature Request
11
I would like to prevent the user from entering certain characters. At the moment, the closest feature is using validation to inform them of invalid input after the fact, but I'd like to prevent them from inputting it in the first place. Being able to define my own rules like in React (see the second example here) would be nice.
Completed
Last Updated: 05 Jan 2021 12:02 by ADMIN
Release 2.21.0

When the Label parameter of the TelerikMaskedTextBox is not defined, the Width is applied to the input of the component. However, it should be applied to the span holding the component.

====================================

ADMIN EDIT

A couple of workarounds:

  • You can define the Label parameter of the TelerikMaskedTextBox. In this case, you will not be facing the mentioned bug and also will not have to separately define a label tag
  • You can set the Bootstrap class "form-control" to the TelerikMaskedTextBox through its Class parameter and remove the Width parameter.

=====================================