No one in ASP. net mvc is willing to use the <asp: Calendar...> control? It must require a form on the server, but this is against the MVC principle, so we cannot use it.
Maybe you can use JavaScript calendar to solve your problem, which is also good.
I recommend a calendar "control", which is extended to htmlhelper, so you can use <% = html. calendar () %> to get a standardized calendar.
To download source code and examples please go to: http://shinyzhu.com/blog/entry/aspnet-mvc-calendar (this address is temporarily closed, please go to the following link)
And don't forget to support this project: http://www.codeplex.com/mvcapps
First, let's talk about the functions of this calendar. Simply put, it can display the calendar of a specified month. The simplest way is HTML. calendar, which generates a calendar of the current month. To specify a date, you also need to specify a name, because the same ID cannot appear multiple times on the same page, so I have this requirement.CodeYes:
<% = Html. Calendar ("othername", selecteddate) %>
The month of the specified date is displayed.
In fact, this principle is to traverse every day of the month and then output an HTML string. Is it easy?
One of my requirements is to archive the current log by date. If there is a log on that day, I need to have a link on the calendar to link to the archiving of the day.
This is why I expanded it.
For specific applications, see the code:
Public static stringCalendar (ThisHtmlhelperHelper,StringName,DatetimeSelecteddate,Ienumerable<Datetime> Rawdates,StringControllername,StringActionname );
This is a method prototype.
For example:
The result is:
Okay. Note that controller and action are specified in the current calendar link. Currently, values only supportsDate = year-month-dayOrDate = year-monthTwo formats. You can configure"Blog/archive/{date}"Then we can generate a link like my website. Is it convenient?
Thank you! Thank you. The image has been updated.