Calendar 日历控件
2008-11-14 14:41
302 查看
日历控制显示用户能选择日期的月日历。 使用简单的日历控制,以下样品说明。
calendar1_cs.aspx
calendar1_cs.aspx
calendar5_cs.aspx <html> <head> <script language="C#" runat="server"> String [][] holidays; void Page_Load(Object Sender, EventArgs e) { holidays = new String[13][]; for (int n=0; n<13 ;n++) holidays = new String[32]; holidays[1][1] = "New Year's Day"; holidays[1][26] = "Australia Day"; holidays[2][2] = "Groundhog Day"; holidays[2][14] = "Valentine's Day"; holidays[3][17] = "St. Patrick's Day"; holidays[4][1] = "April Fool's Day"; holidays[5][1] = "May Day"; holidays[6][15] = "My Birthday"; holidays[7][15] = "My Anniversary"; holidays[8][15] = "My Mother's Birthday"; holidays[9][24] = "Autumnal Equinox"; holidays[12][26] = "Boxing Day"; } void Calendar1_DayRender(object sender, DayRenderEventArgs e) { CalendarDay d = ((DayRenderEventArgs)e).Day; TableCell c = ((DayRenderEventArgs)e).Cell; if (d.IsOtherMonth) { c.Controls.Clear(); } else { try { string Hol = holidays[d.Date.Month][d.Date.Day]; if (Hol != string.Empty) c.Controls.Add(new LiteralControl("<br>" + Hol)); } catch (Exception exc) { Response.Write (exc.ToString()); } } } void Date_Selected(object s, EventArgs e) { Label1.Text = "Selected date is: " + Calendar1.SelectedDate.ToShortDateString(); } </script> </head> <body> <h3><font face="Verdana">Adding Custom Content to Calendar</font></h3> <p><p> <form runat=server> <asp:Calendar id=Calendar1 runat="server" ondayrender="Calendar1_DayRender" onselectionchanged="Date_Selected" ShowGridLines="true" Font-Names="Verdana;Arial" Font-Size="9px" Width="500px" VisibleDate="01/01/2000" TitleStyle-BackColor="Gainsboro" TitleStyle-Font-Size="12px" TitleStyle-Font-Bold="true" DayStyle-VerticalAlign="Top" DayStyle-Height="50px" DayStyle-Width="14%" SelectedDate="1/1/0001" SelectedDayStyle-BackColor="Navy" /> <p> <asp:Label id=Label1 runat="server" /> </form> </body> </html>
相关文章推荐
- JS写的Calendar日历控件
- asp.net2.0里用Calendar控件做带节日提示的日历
- 如何将Calendar日历控件中文星期变成英文
- ASP.NET Calendar日历(日期)控件使用方法
- kimsoft-jscalendar 日历控件
- js非常强大的日历控件fullcalendar.js, 日期时间库: moment.js
- AjaxControlToolKit CalendarExtender(日历扩展控件)的使用方法
- 跟我做:Javascript 下的日历控件(Calendar)
- c# Calendar 日历控件 基本使用说明
- [引]雅虎日历控件 Example: Two-Pane Calendar with Custom Rendering and Multiple Selection
- 使用Ajax控件CalendarExtender完成单击文本框弹出日历功能[转]
- 2-13 monthCalendar日历控件
- 很好用的日历控件(calendar)
- fullcalendar日历控件知识点集合
- c# Calendar 日历控件 基本使用说明
- shawl.qiu javascript 日历控件类(Calendar) v1.0
- 超酷asp.net 2.0 Ajax日历控件_Obout_Calendar控件去限制版
- AjaxToolKit--日历控件Calendar的介绍
- 日历Calendar控件的使用
- fullcalendar日历控件知识点集合