Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
MVC validators like required field etc..are they c# attributes?

I was learning C# attributes, I have one doubt that whether MVC validators are example of attributes or not ? I think they are.
As i learned attributes are for description of element. We can create custom attributes which can give description for a element(method,class etc.) This is the us of attributes as per my understanding. Is that correct? Is there any other use for attributes?
If MVC require filed validator is a attribute how does that works? i mean how the code has written in atribute.It is doing more than providing help information so how is that works ?
Posted
Updated 20-Apr-15 20:28pm
v2

1 solution

You can create your own custom attributes. Generally, data annotations are customized to suit your needs.

Try
Custom Validation Attribute in ASP.NET MVC3[^]
ASP.NET MVC Custom Compare Data Annotation with Client Validation[^]
MVC 4: Custom Validation Data Annotation Attribute[^]
 
Share this answer
 
Comments
Mehdi Gholam 21-Apr-15 2:48am    
5'ed
Abhinav S 21-Apr-15 2:51am    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900