How to add placeholder to c# code ? I want to display DateTime.Now in my form.
<div class="col-md-10">
@Html.EditorFor(model => model.Date, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Date, "", new { @class = "text-danger" })
</div>
Have your tried -
@Html.EditorFor(model => model.Date, new { placeholder = DateTime.Now.ToString("MM/dd/yyyy")})