CalendarDay.DayNumberText Property
Gets the string equivalent of the day number for the date represented by an instance of the CalendarDay class. This property is read-only.
[Visual Basic] Public ReadOnly Property DayNumberText As String [C#] public string DayNumberText {get;} [C++] public: __property String* get_DayNumberText(); [JScript] public function get DayNumberText() : String;
Property Value
The string equivalent of the day number for the date represented by an instance of this class.
Remarks
Use the DayNumberText property to determine the string equivalent of the day number for the date represented by an instance of this class. This allows you to programmatically control the appearance or behavior of the day, based on this value.
Example
[Visual Basic, C#] The following example demonstrates how to use the DayNumberText property to display the selected day number on the Calendar control.
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script language="VB" runat="server"> Sub DayRender(source As Object, e As DayRenderEventArgs) If e.Day.IsSelected Then Label1.Text &= ChrW(60) & "br" & ChrW(62) & e.Day.DayNumberText End If End Sub 'DayRender </script> </head> <body> <form runat="server"> <asp:Calendar id="calendar1" runat="server" SelectionMode="DayWeekMonth" WeekendDayStyle-BackColor="gray" OnDayRender="DayRender"/> <br><br> You selected the following date(s): <br> <asp:Label id="Label1" runat="server"/> </form> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script language="C#" runat="server"> void DayRender(Object source, DayRenderEventArgs e) { if (e.Day.IsSelected) { Label1.Text += "<br>" + e.Day.DayNumberText; } } </script> </head> <body> <form runat="server"> <asp:Calendar id="calendar1" runat="server" SelectionMode="DayWeekMonth" WeekendDayStyle-BackColor="gray" OnDayRender="DayRender"/> <br><br> You selected the following date(s): <br> <asp:Label id="Label1" runat="server"/> </form> </body> </html>
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
CalendarDay Class | CalendarDay Members | System.Web.UI.WebControls Namespace | Calendar