when the view is loading , the tax date column is always showing with the value '01/01/0001 00:00:00' untill the date selected from datepicker. How can I set the datetime value set to null when the view is loaded.
This is model
public class Vehicles { [Key] public int Id { get; set; } public string Make { get; set; } public string Model { get; set; } public string RegNo { get; set; } public string VehicleName {get;set;} public DateTime TaxDate { get; set; } public DateTime RegDate { get; set; } }
controller
public async Task<IActionResult> UpsertVehicle(int? vehicleId) { VehicleVM vehiclesVM = new VehicleVM(); return View(vehiclesVM); }
view
<form asp-controller="Vehicle"
asp-action="UpsertVehicle"
data-ajax="true"
data-ajax-method="POST"
data-ajax-mode="replace"
data-ajax-update="#content"
class="form-horizontal"
role="form" data-parsley-validate novalidate><div class="alert-danger" asp-validation-summary="ModelOnly"></div><div class="row"><div class="col-md-6"><div class="form-group row"><label asp-for="Vehicles.Make" class="control-label col-3 col-form-label">Make</label><div class="col-9"><input class="form-control input-sm" type="text" id="inputName"
asp-for="Vehicles.Make" /></div></div></div><div class="row"><div class="col-md-6"><div class="form-group row"><label asp-for="Vehicles.TaxDate" class="control-label col-3 col-form-label">Tax Date</label><div class="col-9"><input class="form-control input-sm" type="text" id="TaxDate"
asp-for="Vehicles.TaxDate" /><span asp-validation-for="Vehicles.TaxDate" class="text-danger"></span></div></div></div></div></form>