6
Reply

which namespace is required in MVC for validation?

Yogesh Bajpai

Yogesh Bajpai

12y
3.6k
0
Reply
    system.Componetmodel.dataanotation
    System.ComponentModel.DataAnnotations Namespace
    System.ComponentModel.DataAnnotations Example : using System.ComponentModel.DataAnnotations; namespace SuperheroSample.Models { public class Superhero { [Required] public string Name { get; set; } public bool WearsCape { get; set; } } }
    System.ComponentModel.DataAnnotations
    System.ComponentModel.DataAnnotations
    If you want to perform model validation using DataAnnotations Attributes, you must include System.ComponentModel.DataAnnotations name space. there are many DataAnnotation attributes are in MVC for validation Please refer below link for more details. http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations(v=vs.100).aspx