ASP.NET IsOtherMonth Property

Definition and Usage

The IsOtherMonth property is used to get whether the date belongs to the month displayed by the calendar.

If the date belongs to the displayed month, it is "FALSE", otherwise it is "TRUE".

Example

The following example shows whether the selected date belongs to the current month:

<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>

Example

Use IsOtherMonth to display whether the selected date belongs to the current month