I have an implementation of the J-Query UI date picker that i am using on a create view.
When i return a blank form in the get action for the create view the date picker fields are being populated with a default value, 01/01/0001. The fields are declared as nullable in the database.
how can i stop these values from being shown in the view?
This is the get action where i am returning an empty customer site object.
public ViewResult Create()
{
CustomerSite customerSite = new CustomerSite();
var customers = repository.GetCustomers;
return View(new SiteAdminCreateViewModel(customerSite, customers));
}
And im using this editor template to remove the time
@model DateTime
@Html.TextBox("", Model.ToString("dd/MM/yyyy"), new { @class = "date" })
And this is the structure im using in the main view
<div class="label-for">@Html.LabelFor(model => model.CustomerSite.PremisesStartDate) </div>
<div class="date-editor">
@Html.EditorFor(model => model.CustomerSite.PremisesStartDate)
@Html.ValidationMessageFor(model => model.CustomerSite.PremisesStartDate)
</div>
Can you set the default date of the JQuery control?
Set Jquery Datepicker default date