ASP.NET笔记之Calender的使用说明(2)


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Calender.aspx.cs" Inherits="myTest_Calender" %>

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <html xmlns="http://www.w3.org/1999/xhtml">
 <head runat="server">
     <title>Calender  Control</title>
 </head>
 <body>
     <form runat="server">
     <div>
         <h1>Calender  Control</h1>
         <h2></h2>
         <asp:Calendar runat="server"
                     OnSelectionChanged="Calendar_Select">
         </asp:Calendar>
         <br  />
         <asp:Label runat="server" Text="Label"></asp:Label>
         <br />
         <asp:Label runat="server" Text="Label"></asp:Label>
         <br />
         <asp:Label runat="server" Text="Label"></asp:Label>

         <table>
            <tr>
                <td>Select a month</td>
                <td>
                    <asp:DropDownList runat="server"
                        AutoPostBack="true"
                        OnSelectedIndexChanged="Month_SelectedChange">
                        <asp:ListItem text="January" Value="1" />
                        <asp:ListItem text="February" Value="2" />
                        <asp:ListItem text="March" Value="3" />
                        <asp:ListItem text="April" Value="4" />
                        <asp:ListItem text="May" Value="5" />
                        <asp:ListItem text="June" Value="6" />
                        <asp:ListItem text="July" Value="7" />
                        <asp:ListItem text="Augut" Value="8" />
                        <asp:ListItem text="September" Value="9" />
                        <asp:ListItem text="October" Value="10" />
                        <asp:ListItem text="November" Value="11" />
                        <asp:ListItem text="December" Value="12" />
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Button runat="server"
                        Text="TGIF"
                       />
                </td>
            </tr>
            <tr>
                <td  colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td  colspan="2"><b>Day Range</b></td>
            </tr>

            <tr>
                <td >Starting  Day</td>
                <td >Ending  Day</td>
            </tr>

            <tr>
                <td >
                    <asp:TextBox runat="server"
                        MaxLength="2"></asp:TextBox>
                </td>
                <td >
                    <asp:TextBox runat="server"
                        MaxLength="2"></asp:TextBox>
                </td>
                <td >
                    <asp:Button runat="server" Text="Apply"
                     />
                </td>
            </tr>
         </table>
     </div>
     </form>
 </body>
 </html>


总结: 

(1  采用一些重构,将一些函数方法分离出去,这一块有一些还没分离完全

(2  日期控件还有VisiblMonthChanged事件来处理日历是否被用户更改了月份,   e.NewDate.Year 和e.PreviousDate.Year诸如此类的比较

(3 DayRender事件,可以通过cell和Day来呈现日期的特殊性,例如周末和节假日的颜色,  

e.Day.IsOtherMOnth    e.Day.IsWeekend  等

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjgxjx.html