How to add Label control to Calendar Day Cell
AddLabelControlToCalendarDayCell.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html>
<script runat="server">
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.DayNumberText == "1")
{
Label Label1 = new Label();
Label1.Text = "<br />First Day";
e.Cell.Font.Italic = true;
e.Cell.Font.Size = FontUnit.Small;
e.Cell.Controls.Add(Label1);
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to add Label control to Calendar Day Cell</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:SlateBlue; font-style:italic;">
How to add Label control to Calendar Day Cell
</h2>
<hr width="550" align="left" color="SlateGray" />
<asp:Calendar
ID="Calendar1"
runat="server"
NextPrevFormat="FullMonth"
ForeColor="WhiteSmoke"
SelectionMode="Day"
DayNameFormat="Full"
Font-Names="Book Antiqua"
Font-Size="Medium"
OnDayRender="Calendar1_DayRender"
>
<DayHeaderStyle
BackColor="DimGray"
/>
<DayStyle
BackColor="Crimson"
BorderColor="IndianRed"
BorderWidth="1"
Font-Bold="true"
Font-Italic="true"
/>
<NextPrevStyle
Font-Italic="true"
Font-Names="Arial CE"
/>
<SelectedDayStyle
BackColor="Green"
BorderColor="SpringGreen"
/>
<OtherMonthDayStyle BackColor="DarkRed" />
<TitleStyle
BackColor="MidnightBlue"
Height="36"
Font-Size="Large"
Font-Names="Courier New Baltic"
/>
</asp:Calendar>
</div>
</form>
</body>
</html>


