1、.netCalendar LCblog Calendar eq LCblog_ rT ;, _ K1 ? ,AC ?blog , , F| V, n5 .net eq PostbackCalendar eqB? H BQpostback 1S M P (?postback Yq Q 1 B? b 1 o b CalendarBDayRender Yq YqC B? H(? VV m, n5l B FM : private int arrCurrentDays, arrPreDays, arrNextDays; / M sY - -B/B private int intCurrentMonth,
2、 intPreMonth, intNextMonth; / FibMzblog CalendarDayRender Yq/ / : CalendarDay d = (DayRenderEventArgs)e).Day; TableCell c = (DayRenderEventArgs)e).Cell; / S -Blog F if (intPreMonth = 0) intPreMonth = d.Date.Month; / i eq S H Bi -7 - Bz intCurrentMonth = intPreMonth + 1; if (intCurrentMonth 12) intCu
3、rrentMonth = 1; intNextMonth = intCurrentMonth + 1; if (intNextMonth 12) intNextMonth = 1; arrPreDays = getArrayDay(d.Date.Year, intPreMonth); / -Bblog F arrCurrentDays = getArrayDay(d.Date.Year, intCurrentMonth);/blog F arrNextDays = getArrayDay(d.Date.Year, intNextMonth);/blog F int j = 0; if (d.D
4、ate.Month.Equals(intPreMonth) while (!arrPreDaysj.Equals(0) if (d.Date.Day.Equals(arrPreDaysj) c.Controls.Clear(); c.Controls.Add(new LiteralControl( + d.Date.Day + ); j+; else if (d.Date.Month.Equals(intCurrentMonth) while (!arrCurrentDaysj.Equals(0) if (d.Date.Day.Equals(arrCurrentDaysj) c.Control
5、s.Clear(); c.Controls.Add(new LiteralControl( + d.Date.Day + ); j+; else if (d.Date.Month.Equals(intNextMonth) while (!arrNextDaysj.Equals(0) if (d.Date.Day.Equals(arrNextDaysj) c.Controls.Clear(); c.Controls.Add(new LiteralControl( + d.Date.Day + ); j+; i getArrayDay()ZE V o ZE, R B F, = /: public
6、int getArrayDay(int intYear, int intMonth) int intArray = new int31; /V o |1 p: c| i F string strSql = select data from test where year(data)= + intYear + and month(data)= + intMonth; /DbHelperOleDb1l ExecuteReaderZE, R BOleDbDataReader OleDbDataReader dr = dbAccess.DbHelperOleDb.ExecuteReader(strSq
7、l); int i = 0; while (dr.Read() if (i = 0) intArrayi = Convert.ToDateTime(drdata.ToString().Day; string a=Convert.ToString(intArrayi); i+; else if (Convert.ToDateTime(drdata.ToString().Day != intArrayi - 1) intArrayi = Convert.ToDateTime(drdata.ToString().Day; i+; return intArray; ok , , B/ V ArT . posted on 2008-05-23 08:57 0 (39) (0) I l K