Question

I'm trying to use DateInput from http://jquerytools.org/demos/dateinput/index.html

The demo on their website is clear, I can replicate it on my machine.

The problem now arises in that I am using MVC4 and need to use the 'For' (eg TextBoxFor) helpers...

There is no DateBoxFor

using MVC and the Model. In my head, I'd need something like

 @Html.DateBoxFor(a => a.BillStartDate, new { @class = "width400" })

or (where the last parameter is the type)

  @Html.GenericBoxFor(a => a.BillStartDate, new { @class = "width400" }, "Date")

How can I replicate

<input type="date" />
Était-ce utile?

La solution

Try passing it into the htmlAttributes, like you did with the class:

@Html.TextBoxFor(a => a.BillStartDate, new { @class = "width400", type="date" }

Autres conseils

You were close in your thinking:

@Html.DateBoxFor(a => a.BillStartDate, new { @class = "width400" })

Becomes

@Html.TextboxFor(a => a.BillStartDate, new { @class = "width400", type = "date" })
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top