Skip to content

Instantly share code, notes, and snippets.

@zeqk
Forked from badcommandorfilename/datepicker.cshtml
Created October 31, 2019 15:28
Show Gist options
  • Save zeqk/657d1708764518949931158673c4c539 to your computer and use it in GitHub Desktop.
Save zeqk/657d1708764518949931158673c4c539 to your computer and use it in GitHub Desktop.
C# HTML5 input date datepicker MVC Razor
<!-- How to insert a date editor in a Razor view -->
<div class="form-group">
@Html.LabelFor(model => model.Start, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.Start, new { @type="date", @class = "form-control datepicker", @Value = Model.Start.ToString("yyyy-MM-dd") } )
@Html.ValidationMessageFor(model => model.Start, "", new { @class = "text-danger" })
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment