how to validate in Linq to Sql using Asp.net MVC 3
i m using Linq to SQl for my project, i tried all CRUD operations (Create, Delete, Edit, details) its working, but how to p开发者_开发知识库erform validation, means adding Required , Range, and other common Validation using System. Data. Annotation class,
I don know how to do this, please help me in detail, as i am beginner, how should i validate all user input fields.
Create a partial class for the entity and add a MetadataTypeAttribute on it. Then create the meta data class with object properties and then put annotations on them.
http://diegworld.blogspot.com/2011/05/using-dataannotations-to-validate.html
精彩评论