ASP.NET MVC 4 avoid generation of data-val-date for datetime

后端 未结 3 490
感情败类
感情败类 2020-12-19 05:34

how can I avoid the generation of the html attribute \"data-val-date\" for the element created from a Datetime property?

The model:

public class Regi         


        
3条回答
  •  [愿得一人]
    2020-12-19 06:08

    Add this to your application start in your global.asax file and the form should fire.

    DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;
    

提交回复
热议问题