zeqk
10/31/2019 - 3:28 PM

C# HTML5 input date datepicker MVC Razor

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>