Set default Date as todays Date in jQuery DatePicker in ASP.Net MVC

Last Reply one year ago By dharmendr

Posted one year ago

Code behind in View

<div class="form-group col-md-6">
   @Html.LabelFor(model => model.pickupdate_, htmlAttributes: new { @class = "control-label col-md-2" })
   <div class="col-md-10">
       @Html.Editor("txtpickupdate", DateTime.Now.ToShortDateString(), new { htmlAttributes = new { @class = "form-control input-datepicker", @placeholder = "mm/dd/yyyy" } })  
       @Html.ValidationMessageFor(model => model.pickupdate_, "", new { @class = "text-danger" })
   </div>
</div>

 

 

Posted one year ago

Hi GuruLogu,

There are options to set the default Date. If you didn't change anything by default it will show the current date. If you still want then you can set like below.

$( ".selector" ).datepicker({ defaultDate: new Date() });

 

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html