Interviews6 answers
which namespace is required in MVC for validation?

Yogesh Bajpai
Posted Apr 2, 2013, 9:26 AM EDT6 Answers
system.Componetmodel.dataanotation
Ashish Kumar JaiswalPosted Dec 6, 2016, 12:58 AM EST
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; }
}
}
Rajkumar RajigounderPosted Apr 1, 2015, 1:42 AM EDT
System.ComponentModel.DataAnnotations
Bhabani PrasadPosted May 23, 2014, 12:06 AM EDT
System.ComponentModel.DataAnnotations
Yashlok KumarPosted May 17, 2014, 6:52 AM EDT
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
Jignesh TrivediPosted Apr 13, 2014, 11:52 PM EDT
System.ComponentModel.DataAnnotations Namespace
Ranjeet PatelPosted Feb 19, 2014, 11:30 PM EST



