Pergunta

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" />
Foi útil?

Solução

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

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

Outras dicas

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" })
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top