Calendar controls for ASP. NET MVC

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.