ASP.NET IsOtherMonth 属性
定义和用法
IsOtherMonth 属性用于获取日期是否属于日历所显示的月份。
如果日期属于所显示的月份,则为 "FALSE",否则为 "TRUE"。
实例
下面的例子展示了被选日期是否属于当前月:
<script runat="server">
Sub DaySelect(obj As Object, e As DayRenderEventArgs)
If e.Day.IsSelected Then
If e.Day.IsOtherMonth
= "TRUE" Then
Label1.Text = "NO"
Else
Label1.Text = "YES"
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>