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

ASP.NET Core MaskedTextBox Prefix and Suffix

Loading Demo...
  • EXAMPLE
  • VIEW SOURCE
  • Edit in Telerik REPL
HtmlHelper
TagHelper
Files:
prefix_suffix.cshtml
Prefix_SuffixController.cs
Prefix_Suffix_TagHelper.cshtml

Also available for:

CLIENT-SIDE API HTML HELPER API

Description

The ASP.NET Core MaskedTextBox component provides the option for adding custom content like icons, HTML elements, images, and more, as prefix and suffix adornments for enhancing the user interface interactivity.

The prefix input adornment is an element placed before the user input field, and it is commonly used to clarify the expected data in the input, such as currency symbols or unit indicators. The Prefix functionality is set up through the PrefixOptions() configuration, and it supports the following options:

  • Icon()—Inserts an icon before the MaskedTextBox element. Accepts the name for an existing icon in the Kendo UI theme or SVG content.
  • Template()—Adds custom content before the MaskedTextBox element. You can use a variety of templating options like TemplateId(), TemplateHandler(), and more.
  • Separator(false)—Removes the separator of the prefix adornment. By default, the separator is visible.

The suffix input adornment is an element positioned after the user input field. Usually, it provides direct functionality for the entered data, like password visibility toggles, formatting, or clearing the input. The Suffix functionality is set up through the SuffixOptions() configuration, and it supports the same options as the Prefix feature:

  • Icon()—Inserts an icon after the MaskedTextBox element.
  • Template()—Adds custom content for the suffix adornment of the MaskedTextBox.
  • Separator(false)—Removes the separator of the suffix adornment. By default, the separator is visible.

This demo shows how to add a DropDownList component before the MaskedTextBox and insert an icon after the MaskedTextBox element.

Additional Apps

This MaskedTextBox example is part of unique collection of hundreds of ASP.NET Core demos, with which you can see all Telerik ASP.NET Core components and their features in action. View the source code of the demos from the library or directly adapt, and edit them and their theme appearance in Telerik REPL for ASP.NET Core or ThemeBuilder.

Support & Learning Resources

Additional Resources