We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MaskedTextBoxFor and Model Binding not work


I need to implement mask equal to "hh:mm" in @Html.EJS().MaskedTextBoxFor(model => model.value,...

The example from documentation not work, / MaskedTextBox / How To / MaskedTextBoxFor and Model Binding

helpme with example for .Mask("00:00")  please.

4 Replies

CI Christopher Issac Sunder K Syncfusion Team April 5, 2019 01:40 PM UTC

Hello Luis, 

Good day to you!! 

We have checked the reported issue and we would like to let you know that, if you enable the mask format for the EJ2 MakEdit component, each mask character will be considered as the value. Because of this behavior, required field validation is not working for the MaskEditFor component. So, we suggest to add the custom validation for your requirement as mentioned in the below UG documentation link. 

Please revert us if you need any further assistance on this. 


LU luis April 5, 2019 09:20 PM UTC

My problema is whith MaskedTextBoxFor for Model Binding MVC, need locate the mask  equal .Mask("00:00").  


This appears in the documentation …

Syncfusion.EJ2.Inputs.MaskedTextBox mask1 = new Syncfusion.EJ2.Inputs.MaskedTextBox();

            ViewData["Mask"] = mask1


@Html.EJS().MaskedTextBoxFor(model => model.value, (Syncfusion.EJ2.Inputs.MaskedTextBox)ViewData["Mask"]).Width("200px").Created("onCreate").Render()



know locate the mask  equal to .Mask("00:00")  in MaskedTextBoxFor ?, please need example that really work.

LU luis April 6, 2019 12:46 PM UTC


I have solved the problem in this way :

@model VigiaNet2.Models.Jornada2Set

@using Syncfusion.EJ2

    Syncfusion.EJ2.Inputs.MaskedTextBox mask1 = new Syncfusion.EJ2.Inputs.MaskedTextBox();
    mask1.Mask = "00:00";
    ViewData["Mask"] = mask1;

    <div class="form-row">
        <div class="form-group col-md-6">
            <div class="e-float-input e-control-wrapper">
                @Html.EJS().MaskedTextBoxFor(model => model.hora1, (Syncfusion.EJ2.Inputs.MaskedTextBox)ViewData["Mask"]).Placeholder("Inicia 1").FloatLabelType(Syncfusion.EJ2.Inputs.FloatLabelType.Always).Render()

Thank you if there is a better way.

PO Prince Oliver Syncfusion Team April 8, 2019 06:46 AM UTC

Hello Luis, 

Good day to you. 

Yes, this the correct way to bind the model value. We are glad that the issue is resolved in your end. Please let us know if you have any further queries. 


Live Chat Icon For mobile
Up arrow icon