I'm always getting the validation message like following when I submit the form to call post Action (Method)
The field ReportStartDate must be a date.
My model is
public class ReportModel
{
public DateTime? ReportStartDate { get; set; }
public DateTime? ReportEndDate { get; set; }
}
My view is like the following,
@using(@Html.BeginForm())
{
<div>
@Html.Bootstrap().ControlGroup().TextBoxFor(m => m.ReportStartDate).Label().LabelText("Start Date")
@Html.Bootstrap().ControlGroup().TextBoxFor(m => m.ReportEndDate).Label().LabelText("End Date")
<div class="form-actions align-right">
@Html.Bootstrap().SubmitButton().Text(AOCrowdFund.Resources.Global.Report).Id("GenerateReport")
</div>
</div>
}
Note:
I am using jquery datepicker for this fields
Note:
Even if i use like the following, I'm getting the same error..
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
[Required(ErrorMessageResourceName = "ErrFieldRequired", ErrorMessageResourceType = typeof(Resources.Global))]
public DateTime? ReportStartDate { get; set; }
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
[Required(ErrorMessageResourceName = "ErrFieldRequired", ErrorMessageResourceType = typeof(Resources.Global))]
public DateTime? ReportEndDate { get; set; }