ASP.NET CalendarDay IsWeekendPropriété


CalendarDay 控件Contrôle CalendarDay

Définition et utilisation

La propriété IsWeekend permet de déterminer si la date correspond à un samedi ou un dimanche.

Si la date tombe un week-end, la propriété retourne "TRUE", sinon elle retourne "FALSE".


Exemple

L'exemple suivant indique si la date sélectionnée tombe un week-end :

<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"/>
  La date sélectionnée tombe un week-end :
  <asp:Label id="Label1" runat="server"/>
</form>

Voir l'exemple »

CalendarDay 控件Contrôle CalendarDay Autres extensions