1
Answer

How to bind form fields using data-annotation?

Guest User

Guest User

4y
532
1
Hi Team
 
I have this model and want to bind form field using data-annotation. My problem i cant seem to bind them as once, using one error. Anyone who can help me on this please? Example is on my screenshot view of the form. 
  1. [Required]  
  2. public string StreetAddress { getset; }  
  3.   
  4. [Required]  
  5. public string StreetAddressLine { getset; }  
  6.   
  7. [Required]  
  8. public string City { getset; }  
  9.   
  10. [Required]  
  11. public string StateProvince { getset; }  
  12.   
  13. [Required(ErrorMessage = "This field is required")]  
  14. public int ZipCode { getset; }  
Answers (1)