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> ";
}
Else
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.