0

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" />
1
  • @Html.TextBoxFor(a => a.BillStartDate, new { @class = "width400", type = "date" }) Doesn't this work? Commented May 12, 2014 at 15:16

2 Answers 2

2

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

@Html.TextBoxFor(a => a.BillStartDate, new { @class = "width400", type="date" }
Sign up to request clarification or add additional context in comments.

Comments

2

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" })

2 Comments

No need for the @type.
Good catch. Copy and paste strikes again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.