Search code examples
c#placeholder10gen-csharp-driver

How to add placeholder to c# code?


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>

Solution

  • Have your tried -

      @Html.EditorFor(model => model.Date, new { placeholder =  DateTime.Now.ToString("MM/dd/yyyy")})