jeff
jeff

Reputation: 446

How to implement one validation message in checking all the required fields in ASP.net MVC 3?

I would like to ask some codes on how to implement one validation message in checking required fields of a model. For example:

I have a model named "AdminUsers" and having firstname, lastname, email, username and password properties. Then, all of these fields are required.

I need to show one validation message (says: "Please complete all fields marked with *") if some of them is not been supply and,

the label should be change to red if this field is not supply.

Please see below:

Manage User Please advise.

Thanks.

Upvotes: 0

Views: 508

Answers (1)

serge.karalenka
serge.karalenka

Reputation: 990

I suggest that the best approach here would be to implement the IValidatableObject interface by your model (view model) object.

Upvotes: 1

Related Questions