ASP.NET CalendarDay IsToday 屬性
CalendarDay 控件
定義和用法
IsToday 屬性用于獲取日期是否是當前日期。
如果日期是當前日期,則該屬性返回 "TRUE",否則返回 "FALSE"。
實例
下面的實例顯示了被選日期是否是當前日期:
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
??If e.Day.IsSelected Then
????If e.Day.IsToday = "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 the current month:
??<asp:Label id="Label1" runat="server"/>
</form>
演示實例 ?
CalendarDay 控件
更多建議: