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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

MaskedTextBoxFor and Model Binding not work

Thread ID:





143795 Apr 5,2019 03:56 AM UTC Apr 8,2019 06:46 AM UTC ASP.NET MVC - EJ 2 4
Tags: MaskedTextbox
Asked On April 5, 2019 03:56 AM UTC


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.

Christopher Issac Sunder K [Syncfusion]
Replied On 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. 


Replied On 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.

Replied On 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.

Prince Oliver [Syncfusion]
Replied On 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. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon