View Single Post
  #1 (permalink)  
Old January 2nd, 2004, 08:44 PM
Mike Smith Mike Smith is offline
Registered User
Join Date: Dec 2003
Location: Oakville, Ontario, Canada.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lesson on Event Calendar - Chapter 14

I am working through Chapter 14 of "Professional C# Second Edition". This is a lesson on an Event Booking application.

I have entered all the code through to page 782 and the Calendar works properly except the back color for the calendar squares do not show as red when booked.

I have gone in the Events Table and I can see that the bookings are showing there correctly. There is also a getFreeDate feature that prevents the cursor from clicking on a previously booked square on the Calendar. This feature works correctly.

I have tried changing the background color from "red" to "green" and this makes no difference.

The code that develops the red backcolor is shown below. If anyone has any suggestions, I would be pleased to hear from you.

Mike Smith
protected void calendar_DayRender(object sender,
System.Web.UI.WebControls.DayRenderEventArgs e)
if (eventTable.Rows.Count > 0)
    System.DateTime testDate;
    foreach (System.Data.DataRow testRow in eventTable.Rows)
    testDate = (System.DateTime)testRow["EventDate"];
    if (testDate.Date == e.Day.Date)
     e.Cell.BackColor = Color.Red;