<asp:calendar id="Calendar1" CellPadding="2" Width="160px" TitleStyle-BackColor="#000000" BorderColor="#aaaaaa" DayHeaderStyle-BackColor="#5e715e" OtherMonthDayStyle-ForeColor="#cccccc" DayNameFormat="Full" runat="server" TitleStyle-ForeColor="#ffffff" NextPrevStyle-ForeColor="#ffffff" CellSpacing="1" WeekendDayStyle-BackColor="#eeeeee" DayHeaderStyle-ForeColor="#ffffff" SelectionMode="None" TodayDayStyle-BorderColor="#5e715e" TodayDayStyle-BorderWidth="1" TodayDayStyle-Font-Bold="true" TodayDayStyle-ForeColor="#5e715e" > |
private int[] arrCurrentDays,arrPreDays,arrNextDays; //三个变量分别是当前月,前一月,和下一个月 private int intCurrentMonth,intPreMonth,intNextMonth; //三个整型数组存放相对月份写有blog的日期 protected System.Web.UI.WebControls.Calendar Calendar1; //这个就是我们的日历控件了 |
private void Calendar1_PreRender(object sender, System.EventArgs e) { Thread threadCurrent = Thread.CurrentThread; CultureInfo ciNew = (CultureInfo)threadCurrent.CurrentCulture.Clone(); ciNew.DateTimeFormat.DayNames = new string[]{"日","一","二","三","四","五","六"}; ciNew.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday; threadCurrent.CurrentCulture = ciNew; } |
private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e) { //该控件在创建每一天时发生。 CalendarDay d = ((DayRenderEventArgs)e).Day; TableCell c = ((DayRenderEventArgs)e).Cell; } |
……