Implement Calendar Effect in blog

Source: Internet
Author: User
What if the Calendar effect is implemented in the blog?
If there is a log on the current day, the link is displayed; otherwise, the link is not displayed?
If you only use the. NET calendar control and do not use Js for writing, can you implement it?

The answer is yes. How can we implement it?
First, we know that the server control in. net will be PostBack, and the first day of the calendar control will be a PostBack
All we need to do is change its default link so that it does not trigger the PostBack event. Second, we need to know whether there are logs on the day.
If there are no logs, you have to go to the database for query.
Original Calendar effect:

When you click on each day, a piece of JS is actually executed, and then PostBack is performed.
There is a dayrender event in the calendar. This event is triggered every day when it is displayed. We can start from here.

Protected void calendar1_dayrender (Object sender, dayrendereventargs E)
If (E. Day. Date = datetime. Now. Date)
E. Cell. Text = "<B>" + E. Day. Date. day + "</B> ";
E. Cell. Text = "<em>" + E. Day. Date. day + "</em> ";
The above code is very clear. If we find that the day is just today, we will rewrite the content, write it as a rough day, and remove the link.
Otherwise, it is displayed on <em> day </em>.

As for adding a link to a log on that day, I don't need to talk about it.

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: 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.