Asp.Net MVCMNmallikharjuna nulu13yAsked Nov 12, 2013, 5:56 AM1.3k.NETconditional custom validation with data annotations in asp.net mvc with only one field that accept 4 types of validations based on input provided like email,phone number,Number and text
Jignesh Trivedi13y agoPosted Nov 12, 2013, 8:51 AMhi,I think this can be achieve by using CustomValidation Attribute.Please refer http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.customvalidationattribute(v=vs.95).aspxwith this attribute you can access other properties of class.hope this will help you.
MNmallikharjuna nulu13y agoPosted Nov 12, 2013, 8:44 AMOne of the field is there in view,that accepts email,phone number,text,Numerics data types.These 4 proerties is declared in enum type. And whatever provide input based on that validate that fieldin asp.net mvc?
Jignesh Trivedi13y agoPosted Nov 12, 2013, 6:32 AMhi,Are you taking about creating custom validation attribute?Please refer following link it might help you.http://www.c-sharpcorner.com/UploadFile/ff2f08/creating-custom-validation-attribute-for-data-annotation/
Jaganathan Bantheswaran13y agoPosted Nov 12, 2013, 6:21 AMQuestion is not clear. What is the exact problem?
Jignesh TrivediPosted Nov 12, 2013, 8:51 AM
hi,
I think this can be achieve by using CustomValidation Attribute.
Please refer
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.customvalidationattribute(v=vs.95).aspx
with this attribute you can access other properties of class.
hope this will help you.
mallikharjuna nuluPosted Nov 12, 2013, 8:44 AM
Jignesh TrivediPosted Nov 12, 2013, 6:32 AM
hi,
Are you taking about creating custom validation attribute?
Please refer following link it might help you.
http://www.c-sharpcorner.com/UploadFile/ff2f08/creating-custom-validation-attribute-for-data-annotation/
Jaganathan BantheswaranPosted Nov 12, 2013, 6:21 AM