Can render message in the calendar control?

  • Thread starter Thread starter Quentin Huo
  • Start date Start date
Q

Quentin Huo

Hi:

I want to present some massages in the calender control. Can I do that?

Thanks

Q.
 
Quentin,

I assume you mean to add data to a Day on the calendar? If that is the
case, check out the DayRender event. You can add code within to manipulate
the text of each day. The following is a sample (C#) from VS2003 Help:

void DayRender(Object source, DayRenderEventArgs e)
{

// Change the background color of the days in the month
// to yellow.
if (!e.Day.IsOtherMonth && !e.Day.IsWeekend)
e.Cell.BackColor=System.Drawing.Color.Yellow;

// Add custom text to cell in the Calendar control.
if (e.Day.Date.Day == 18)
e.Cell.Controls.Add(new LiteralControl("<br>Holiday"));

}

Ian Suttle
http://www.IanSuttle.com
 
Back
Top