YouTip LogoYouTip

Prop Webcontrol Calendarday Daynumbertext

## ASP.NET CalendarDay.DayNumberText Property The `DayNumberText` property is a member of the `CalendarDay` class in ASP.NET. It is used to retrieve the string representation of the day number for a specific date displayed in the `Calendar` control. --- ## Definition and Usage The `DayNumberText` property returns a string that represents the day of the month (e.g., "1", "2", "15", "31") for the corresponding day being rendered in the `Calendar` control. This property is particularly useful during the `DayRender` event, where you can inspect or manipulate individual days as they are being drawn on the screen. Unlike the `Date.Day` property (which returns an integer), `DayNumberText` provides the pre-formatted string representation of the day number, making it ideal for direct UI output or custom text rendering. --- ## Syntax ```vb ' Visual Basic Syntax Public ReadOnly Property DayNumberText As String ``` ```csharp // C# Syntax public string DayNumberText { get; } ``` ### Property Value * **Type:** `System.String` * **Description:** The string representation of the day number for the specified calendar day. --- ## Code Example The following example demonstrates how to use the `DayNumberText` property during the `DayRender` event. When a user selects a date, the application captures the day number string and displays it in an `asp:Label` control. ```aspx <%@ Page Language="VB" %> CalendarDay DayNumberText Example

CalendarDay DayNumberText Demo


The selected day number is:

``` --- ## Key Considerations 1. **Read-Only Property:** The `DayNumberText` property is read-only. You cannot programmatically change the day number text directly through this property. 2. **Localization:** The string returned by `DayNumberText` is formatted based on the current culture settings of the application thread. 3. **Event Lifecycle:** This property is typically accessed within the `OnDayRender` event handler of the `Calendar` control, where each day is processed individually before being sent to the browser.
← Prop Webcontrol Calendarday IsProp Webcontrol Calendarday Da β†’