Calendar Control - Multi color Dates
// Here I have tried how to show the
//various back colors for Calendar Control
protected System.Web.UI.WebControls.Calendar Calendar1;
private void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
CalendarDay d = ((DayRenderEventArgs)e).Day;
Label lblSchedule = new Label();
lblSchedule.Text = "123" ;
lblSchedule.BackColor = Color.Honeydew;
//lblSchedule.ToolTip ="Shriniwas Wani out for holidays";
switch(d.DayNumberText)
{
case "1" : e.Cell.BackColor = Color.Red ;
e.Cell.Controls.Add( lblSchedule );
e.Cell.ToolTip = "shriniwas gone for x-mas holidays.." ;
break;
case "2" :
e.Cell.BackColor = Color.Ivory;
break;
case "3" :
e.Cell.BackColor = Color.Green ;
break;
case "4" :
e.Cell.BackColor = Color.Sienna ;
break;
case "16" :
e.Cell.BackColor = Color.Khaki;
break;
default :
e.Cell.BackColor = Color.Pink;
break;
}
if( d.IsOtherMonth ) e.Cell.BackColor = Color.Magenta;
string str = d.DayNumberText ;
}