Continuing the practice of the MVC application, just practiced the DatePicker () method in the jquery UI to allow the user to enter the date quickly in the text box.
The code is concise and simple.
Open a view of the previous exercise views\home\index.cxhtml:
Add an input HTML tag, whose type is text:
Then in the head node of the view, reference jquery UI, how to reference, you can refer to: "MVC program Implementation autocomplete function" http://www.cnblogs.com/insus/p/3546255.html This article describes the UI libraries and styles for installing jquery in an MVC application.
In the relative position of your view, reference and write the above 3 parts code, that is done.
Finally, take a look at the effect of the run:
effect See, its display format is the default format of "Month/day/year", can we change its display format? If you want to change the format, there must be no problem. For a better presentation, you may have to refer to this MVC application and dynamically create a radio list (RadioButtonList) http://www.cnblogs.com/insus/p/3551348.html.
But we have to write some jquery code, which means that when the user taps the Radio Button list option, it can change the date display format of the text box. Two procedures, one is to add the change event for the radio single-selection list, and the other is to add option to the DatePicker () method:
Real-time Operation Demo: