What is use of datatype attribute class of data annotation in mvc?

Posted by Kumarkrishna184 under ASP.NET MVC on 2/28/2017 | Points: 10 | Views : 321 | Status : [Member] | Replies : 1
What is use of datatype attribute class in mvc?

Thanks and Regards,
Krishna Kumar



Responses

Posted by: A2H on: 2/28/2017 [Member] [MVP] Silver | Points: 25

Up
0
Down
AFAIK, we use the DataType Attribute to specify the data type associated with the data field .
For ex: If you have a column like EmailAddress in database which is mostly a sting datatype like Nvarchar or varchar. You can use EmailAddress Datatype which is more specific than the database intrinsic types.

 // Add type information.
[DataType(DataType.EmailAddress)]
public object EmailAddress;


Check the below link which give you more details on of usage of datatype
https://www.codeproject.com/articles/777856/asp-net-mvc-what-are-the-uses-of-datatype-and-disp


Thanks,
A2H
My Blog

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response