Search results

Maintain trailing zeros in NumericTextBox in ASP.NET MVC NumericTextBox control

26 Oct 2021 / 1 minute to read

By default, trailing zeros disappear when the NumericTextBox gets focus. However, you can use the following sample to maintain the trailing zeros while focusing the NumericTextBox.

Copied to clipboard
    function numericFocus() {
        var numericObj = this.ej2_instances ? this.ej2_instances[0] : this;
        numericObj.element.value = numericObj.formattedValue(numericObj.decimals, +numericObj.element.value);
    function onCreate() {
        document.getElementById('numeric').addEventListener('focus', numericFocus);
Copied to clipboard
public ActionResult nullableInput()
    return View();