System.Web.UI.WebControls Namespace Calendar Class
Sets or retrieves the value to use as today's date.
[ VB ]
Public Property TodaysDate As DateTime
[ C# ]
public DateTime TodaysDate {get; set;}
[ C++ ]
public: __property DateTime get_TodaysDate ( );
public: __property void set_TodaysDate ( DateTime );
[ JScript ]
public function get TodaysDate ( ) : DateTime;
public function set TodaysDate ( DateTime );
A System.DateTime that contains the value to use for today's date. The default value is the system date on the server.
This date may need to be adjusted to accommodate users who are in a different time zone.
If VisibleDate is empty, it will use the value in TodaysDate.
This is only displayed on the calendar if the date is in the same month as the visible date and the properties of the TodayDayStyle is not empty.
The following example demonstrates how to compare dates to TodaysDate to display all other days in yellow.
<html>
<head>
<script language = "C#" runat = "server">
void DayRender ( Object source, DayRenderEventArgs e ) {
if ( e.Day.Date != myCalendar.TodaysDate )
e.Cell.BackColor=System.Drawing.Color.FromString ( "yellow" );
}
</script>
</head>
<body>
<h3>CalendarDay Date Property Example</h3>
<form runat = "server">
<asp:Calendar id = "myCalendar" runat = "server"
WeekendDayStyle-BackColor = "gray"
onDayRender = "DayRender" />
</form>
</body>
</html>
Show me
Calendar Members