Reputation: 446
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:
Please advise.
Thanks.
Upvotes: 0
Views: 508
Reputation: 990
I suggest that the best approach here would be to implement the IValidatableObject interface by your model (view model) object.
Upvotes: 1