Use of calendar in ASP. net2.0 (add your own date remarks)

Source: Internet
Author: User

I have never liked it.. net. it is mainly because every time he clicks, the refresh will be made. with Ajax. net is also of some use. so let's take a look.

Using system; using system. data; using system. configuration; using system. web; using system. web. security; using system. web. ui; using system. web. UI. webcontrols; using system. web. UI. webcontrols. webparts; using system. web. UI. htmlcontrols; public partial class _ default: system. web. UI. page {// declare an array to place the corresponding holiday // For ease of use, the definition is 13 months, 32 days string [,] days = new string [13, 32]; protected void page_load (Object sender, eventargs E) {Days [1, 1] = "Lantern Festival";} protected void button#click (Object sender, eventargs E) {}/// <summary> /// write the dayrender event // </Summary> /// <Param name = "sender"> </param> // <param name = "E"> </param> protected void calendar#dayrender (Object sender, dayrendereventargs e) {calendarday d = E. day; // obtain the date information of the current cell. tablecell c = E. cell; // obtain the cell if (D. isothermonth) // determines whether to clear the content in the cell {C. controls. clear ();} Else {string myday = days [D. Date. Month, D. Date. Day]; If (myday! = NULL) // if there is a date ..... {c. controls. clear (); // you can clear and then add your own control button B = new button (); B. TEXT = "A"; C. controls. add (B); // For example, a button is added here. killed the original 1. orz C. controls. add (New literalcontrol ("<a Title = '" + myday + "'>★</A> "); C. forecolor = system. Drawing. color. Red; // you can add some cells }}}}

Running Effect

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.