jQuery Datetime picker MVC3

后端 未结 4 1959
长发绾君心
长发绾君心 2021-01-12 12:36

I have in my Model this field

[DataType(DataType.DateTime)]
    [Required(ErrorMessage = \"Expire is required\")]
    public DateTime Expire
    {
      get;         


        
4条回答
  •  再見小時候
    2021-01-12 12:57

    Just put ? in your System.DateTime

    example :

    @model System.DateTime?
    
    @Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue,
                    new
                    {
                        data_datepicker = true
                    })
    

    if you ommit the question mark you will ge an error

提交回复
热议问题