Christophe Debove
Christophe Debove

Reputation: 6296

MVC Validation Attributes Kendo Grid don't work with UIHint

In my model I have

    [Required(ErrorMessage = "BIC Code is required")]
    [RegularExpression("^[a-zA-Z0-9]{11}$",ErrorMessage = "11 alphanumeric characters expected")]
    [UIHint("BicCode")]
    public string BicCode { get; set; } 

The Template corresponding to the BicCode

@model string  
@(Html.Kendo().MaskedTextBox().Name("BicCode").Mask("AAAAAAAAAAA") )

During my kendo grid edition all my validation attribute are used except the ones from properties using UIHint.

How to deal with UIHint Validation and Kendo Grid?

Upvotes: 1

Views: 352

Answers (1)

Christophe Debove
Christophe Debove

Reputation: 6296

As suggested by Steve Greene in his comment.

Use MaskedTextBoxFor(m => m) instead of just MaskedTextBox() solved my problem.

Upvotes: 1

Related Questions