ASP.NET CalendarDay IsToday 属性
定义和用法
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>
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>
演示实例 »
版权声明:本页面内容旨在传播知识,为用户自行发布,若有侵权等问题请及时与本网联系,我们将第一时间处理。E-mail:284563525@qq.com