Data annotation for Salutation
How can I add Data Annotation for Salutation?
A salutation must begin with Dear Sir or Madam, Mr, Mrs, Dr in lower or uppercase?
How can I add Data Annotation for Salutation?
A salutation must begin with Dear Sir or Madam, Mr, Mrs, Dr in lower or uppercase?
I am using DataAnnotations for my model validation i.e.
If I have a search object with a list of fields, can I, using the System.ComponentModel.DataAnnotations namespace, set it up to validate that at least one of the fields in the search is not null or empty? i.e All the fields are optional but at least one should always be entered.
I’ve a ViewModel which has some DataAnnotations validations and then for more complex validations implements IValidatableObject and uses Validate method.
Why can’t I do like this?
To keep my model validation clean I would like to implement my own validation attributes, like PhoneNumberAttribute and EmailAttribute. Some of these can favorably be be implemented as simple classes that inherit from RegularExpressionAttribute.
[Required] [DisplayName("my date")] public DateTime? DateReg { get; set; } so if the user is going to pass in an invalid datetime value he will get this message “The value ‘02.07.201022’ is not valid for my date.” how can I translate/localize this message ? Answers: Thank you for visiting the Q&A section on Magenaut. Please … Read more
I have been googling this non stop for 2 days now and can’t find a single complete, ready to use, fully implemented t4 template that generates DataAnnotations. Do they even exist?
I thought this would be a quick search on google but maybe I’m missing something. Is there a way, using Data Annotations, to set a ViewModel property to create a HiddenInput when the markup get rendered?
I want to create custom client-side validator, but I want define validation rules via Data Annotations attributes at business logic layer. How can I access model validation attributes in runtime?