V
V
Vladislav Sofienko2017-03-25 11:16:56
.NET
Vladislav Sofienko, 2017-03-25 11:16:56

How to display Entity C# validation error?

There is a description of the user class and it describes the validation of its attributes.
For example:

public partial class User
    {
        [Required]
        [EmailAddress(ErrorMessage = "Email был неверно указан.")]
        public string Email { get; set; }
        [Required]
        [RegularExpression(@"\d", ErrorMessage = "Пароль был не верно указан.")]
        public string Password { get; set; }
    }

How to display ErrorMessage on a form?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Zhidkov, 2017-03-25
@VigVam

Use the asp-validation-for attribute

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question