- Home
- Forum
- ASP.NET MVC - EJ 2
- MaskedTextBoxFor and Model Binding not work
MaskedTextBoxFor and Model Binding not work
hi
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 Bindinghelpme with example for .Mask("00:00") please.
SIGN IN To post a reply.
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.
Thanks,
Christo
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
Hi,
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>
....
<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()
</div>
</div>
.....
Thank you if there is a better way.
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>
....
<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()
</div>
</div>
.....
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.
Regards,
Prince
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
LU luis
- Apr 5, 2019 03:56 AM UTC
- Apr 8, 2019 06:46 AM UTC