Share via


VisibleDate Property

Sets or returns a date that specifies the month to display. Has the same functionality as the Web Forms Calendar.VisibleDate property. The default value is System.DateTime.MinValue.

public DateTime VisibleDate {
   get,
   set
}

Remarks

The VisibleDate property is updated after the VisibleMonthChanged event is raised.

The date can be any day within the month. Only the month value of the DateTime object is used.

Example

The following example demonstrates how to use the VisibleDate property to set the visible dates on the calendar.

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");
}

See Also

Applies to: Calendar Class