Sorry I need to be specific. I have tried using the following supplied code from the website however it isn't working.
//Change appearance of the day if there are events there.
private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
{
string fontWeight = "normal";
if (isThereEvent(e.Day.Date))
fontWeight = "bold";
string color = "red";
if (e.Day.IsOtherMonth)
color = this.Calendar1.OtherMonthDayStyle.ForeColor.Name;
e.Cell.Text = String.Format("<a href='Default.aspx?day={0:d}' style='color: "
+ color + ";text-decoration:underline; font-weight:"
+ fontWeight + "'>{1}</a>", e.Day.Date, e.Day.Date.Day);
}
private bool isThereEvent(DateTime date)
{
DateTime today = DateTime.Now;
DateTime tomorrow = today.AddDays(1);
DateTime anotherDay = today.AddDays(3);
// there are events today
if ((date.DayOfYear == today.DayOfYear) && (date.Year == today.Year))
return true;
// there are events tomorrow
if ((date.DayOfYear == tomorrow.DayOfYear) && (date.Year == tomorrow.Year))
return true;
// there are events on another day
if ((date.DayOfYear == anotherDay.DayOfYear) && (date.Year == anotherDay.Year))
return true;
return false;
}
The only difference for me is that I am using an SQL Datasource and not a data table. Do I need to alter this code for it to work?