ASP.NET CalendarDay IsWeekend 属性


CalendarDay 控件 CalendarDay 控件

定义和用法

IsWeekend 属性用于获取日期是否是星期六或星期日。

如果日期在周末,则该属性返回 "TRUE",否则返回 "FALSE"。


实例

下面的实例显示被选的日期是否在周末:

   <script runat="server">
   Sub DaySelect(obj As Object, e As DayRenderEventArgs)
     If e.Day.IsSelected Then
       If e.Day.IsWeekend = "TRUE" Then
         Label1.Text = "YES"
       Else
         Label1.Text = "NO"
       End If
     End If
   End Sub
   </script>
  
   <form runat="server">
     <asp:Calendar id="cal1" runat="server"
     OnDayRender="DaySelect"/>
     The selected date is in a weekend:
     <asp:Label id="Label1" runat="server"/>
   </form> 
 

CalendarDay 控件 CalendarDay 控件