N
N
Nikita2018-06-12 09:42:47
JavaScript
Nikita, 2018-06-12 09:42:47

How to make a calendar in MVC?

Good afternoon, please help.
There was a problem when adding a calendar to the index page
1) There is a Sql table for the DateTo object and Date End, I assigned the date type Date (there is also a question, maybe it was necessary to leave string?
at the moment the code looks like this, I beg you to help me figure out how to this Razor syntax to make a correct calendar :D

<div class="form-group">
        @Html.LabelFor(model => model.DateEnd, "Дата закінчення поїздки", htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.DateEnd, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.DateEnd, "", new { @class = "text-danger" })
        </div>
    </div>

Thank you in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
igorsmi, 2018-06-12
@etozhetisachniy

As I understand it, you just need an input with the date type, you just need to specify it in the attributes

@Html.EditorFor(model => model.DateEnd, new { htmlAttributes = new { @class = "form-control", type="date" } })

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question