設定或傳回指定顯示月份的日期。功能同 Web Form Calendar.VisibleDate 屬性。預設值是 System.DateTime.MinValue。
public DateTime VisibleDate {
get,
set
}
備註
引發 VisibleMonthChanged 事件後會更新 VisibleDate 屬性。
日期可能是月份中的任何一天。只使用 DateTime 物件的月份值。
範例
下列範例示範如何使用 VisibleDate 屬性設定日曆上顯示的日期。
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Calendar1.ShowDayHeader = True
' Sets the first day of the week that you want visible in the
' calendar.
Calendar1.FirstDayOfWeek = WebControls.FirstDayOfWeek.Friday
Calendar1.VisibleDate = DateTime.Parse("6/5/2001")
End Sub
[C#]
protected void Page_Load(Object sender, EventArgs e)
{
Calendar1.ShowDayHeader = true;
// Sets the first day of the week that you want visible in the
// calendar.
Calendar1.FirstDayOfWeek = WebControls.FirstDayOfWeek.Friday;
Calendar1.VisibleDate = DateTime.Parse("6/5/2001");
}
請參閱
套用至:Calendar 類別