When the MVC view page with this textbox, loads , I would like to display current date and time by default. How can I do this? in razor.
@Html.EditorFor(mo
You could initialize ReturnDate on the model before sending it to the view.
In the controller:
[HttpGet] public ActionResult SomeAction() { var viewModel = new MyActionViewModel { ReturnDate = System.DateTime.Now }; return View(viewModel); }