asp.net.ph

Calendar.TodaysDate Property

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

Property Value

A System.DateTime that contains the value to use for today's date. The default value is the system date on the server.

Remarks

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.

Example

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 

See Also

Calendar Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph