I am using ASPX.NET MVC4, with aspx as view engine. I have a function at my controller, which takes as input a start date and an enddate. I want these dates to be given by the user using a DatePicker, or something similar, and after that to be passed at the controller.
However, I found that asp does not have a DatePicker. How do I use a datepicker for my application?
I also looked here and here but I did not find them really helpful. Do you know how I am able to do that?
If you're using a standard ASP.NET MVC template then you're very likely already loading/using jQuery. It's also pretty likely that you're loading/using jQuery UI . (If not, it's easy enough to include . There's even a handy NuGet package for it.)
Given this, converting any input type="text"
(or @Html.TextBox()
or any number of other server-side helpers which emit an input type="text"
) into a "date picker" is a single line of code:
$(targetInputs).datepicker();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.