开发者

how to validate in Linq to Sql using Asp.net MVC 3

开发者 https://www.devze.com 2023-03-26 06:27 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号