aspx:
<asp:calendar id="Calendar1" CellPadding="2" DayNameFormat="Full" runat="server"
SelectionMode="None" >
<TodayDayStyle Font-Bold="True" BorderWidth="1px" ForeColor="#5E715E" BorderColor="#5E715E"></TodayDayStyle>
<NextPrevStyle ForeColor="White"></NextPrevStyle>
<DayHeaderStyle ForeColor="White" BackColor="#404040"></DayHeaderStyle>
<TitleStyle ForeColor="White" BackColor="Black"></TitleStyle>
<WeekendDayStyle BackColor="Silver"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#CCCCCC"></OtherMonthDayStyle>
</asp:calendar>
</div>cs:using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class ajax_price : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// 在此处放置用户代码以初始化页面
} protected void Calendar1_DayRender(object sender,DayRenderEventArgs e)
{
CalendarDay d = ((DayRenderEventArgs)e).Day;
TableCell c = ((DayRenderEventArgs)e).Cell;
//如果每月的日期等于18日,就在日期单元格中添加 Holiday
if (e.Day.Date.Day == 18)
{
c.Controls.Add(new LiteralControl("<br>Holiday"));
} }
}
结果一点变化都没有
<asp:calendar id="Calendar1" CellPadding="2" DayNameFormat="Full" runat="server"
SelectionMode="None" >
<TodayDayStyle Font-Bold="True" BorderWidth="1px" ForeColor="#5E715E" BorderColor="#5E715E"></TodayDayStyle>
<NextPrevStyle ForeColor="White"></NextPrevStyle>
<DayHeaderStyle ForeColor="White" BackColor="#404040"></DayHeaderStyle>
<TitleStyle ForeColor="White" BackColor="Black"></TitleStyle>
<WeekendDayStyle BackColor="Silver"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#CCCCCC"></OtherMonthDayStyle>
</asp:calendar>
</div>cs:using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class ajax_price : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// 在此处放置用户代码以初始化页面
} protected void Calendar1_DayRender(object sender,DayRenderEventArgs e)
{
CalendarDay d = ((DayRenderEventArgs)e).Day;
TableCell c = ((DayRenderEventArgs)e).Cell;
//如果每月的日期等于18日,就在日期单元格中添加 Holiday
if (e.Day.Date.Day == 18)
{
c.Controls.Add(new LiteralControl("<br>Holiday"));
} }
}
结果一点变化都没有
<asp:Calendar ID="Calendar1" CellPadding="2" DayNameFormat="Full" runat="server"
SelectionMode="None" OnDayRender="Calendar1_DayRender">