using System.Drawing;
public partial class Calender : System.Web.UI.Page
{
string[,,] holiday=new string[3000,13,32];
protected void Page_Load(object sender, EventArgs e)
{
holiday[2007, 10, 12] = "12hao";
holiday[2008, 1, 12] = "hao";
}
protected void Button1_Click(object sender, EventArgs e)
{
holiday[2007, 10, 13] = "o";
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
DateTime Mytest = new DateTime(2007, 10, 1);
if (e.Day.Date == Mytest)
{
e.Day.IsSelectable = true;
}
else
{
e.Day.IsSelectable = false;
}
string aho;
DateTime d = e.Day.Date;
aho=holiday[d.Year,d.Month,d.Day];
if (aho != null)
{
Label a = new Label();
a.Text = "<br/><center>" + aho + "</center>";
//添加一个控件
e.Cell.Controls.Add(a);
}
else {
e.Cell.Text = "<font color='red'>"+e.Day.Date.Day+"</font>";
e.Cell.BackColor = Color.Blue;
}
}
}