The ASP. NET Calendar is a Microsoft-brought calendaring control that, in addition to the simple display of datetime, can bind some required events. The Calendar_dayrender event is the way to load all the time dates, using this method to add the event you need on each calendar day, and write a corresponding pragmatic caseprotected voidCalendar1_dayrender (Objectsender, Dayrendereventargs e) {///when the date is not the current month, the number of days is removed (that is, the panel showing the date this month does not show the last month or the next month's extra date) if(e.day.isothermonth) {e.cell.controls.clear (); return; } //Add the JS ononmouseover event e.cell.attributes["onmouseover"] = "Mouseov ()" to each current date cell; ///add a class style to the current date only if(E.day.date.tostring ("YYYY/MM/DD") = = DateTime.Now.ToString ("YYYY/MM/DD")) {//today is the name of the stylee.cell.attributes["class"] ="Today"; }} and another is the Calendar_prerender event, this event I used to do the regional date automatic change, such as you want the English calendar as followsprotected voidCalendar1_prerender (Objectsender, System.EventArgs e) {System.Globalization.CultureInfo MyInfo=NewSystem.Globalization.CultureInfo ("en -US",false); System.Threading.Thread.CurrentThread.CurrentCulture=MyInfo; If it is in Chinese, the above en-us Change to zh-cn in Calendar_prerender can also define some other properties, forexample name of the weekPrivate voidCalendar1_prerender (Objectsender, System.EventArgs e) {Thread threadcurrent=Thread.CurrentThread; CultureInfo cinew=(CultureInfo) ThreadCurrent.CurrentCulture.Clone (); CiNew.DateTimeFormat.DayNames=New string[]{"Day","a","two","three","Four","Five","Six"}; CiNew.DateTimeFormat.FirstDayOfWeek=dayofweek.sunday; Threadcurrent.currentculture=cinew;}
ASP. NET Calendar Control usage