Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Professional C#, 2nd and 3rd Editions
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional C#, 2nd and 3rd Editions
This is the forum to discuss the Wrox book Professional C#, 3rd Edition by Simon Robinson, Christian Nagel, Karli Watson, Jay Glynn, Morgan Skinner, Bill Evjen; ISBN: 9780764557590
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C#, 2nd and 3rd Editions section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 2nd, 2004, 07:44 PM
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;
        †††}
        }
†††}
}
  #2 (permalink)  
Old January 29th, 2004, 10:58 AM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got the same results... apparently, the calendar_DayRender event isn't even firing. If you get an answer, I would be interested in hearing the resolution

  #3 (permalink)  
Old January 29th, 2004, 11:12 AM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't know why the 'DayRender' event isn't firing automatically, but I did find a way to get the event to fire. In the <asp:Calendar... object declaration, include the following...

OnDayRender="calendar_DayRender"

this causes the DayRender event to fire.

  #4 (permalink)  
Old February 4th, 2004, 03:13 AM
Registered User
 
Join Date: Jan 2004
Location: Memphis, Tn, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Iam having a similar problem with this same code. It is showing up in my case as an unhandled exception: Here are the details

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


private System.DateTime getFreeDate(System.DateTime trialDate)
{
if (eventTable.Rows.Count > 0) <--- error identified here....
{
System.DateTime testDate;


Jim
  #5 (permalink)  
Old April 6th, 2004, 02:39 AM
Authorized User
 
Join Date: Apr 2004
Location: Shah Alam, Selangor, Malaysia.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kekohchaa
Default

Is there any sample of the Event Booking Application in vb.net? or asp.net?
Thanks


  #6 (permalink)  
Old April 6th, 2004, 03:00 PM
Registered User
 
Join Date: Jan 2004
Location: Memphis, Tn, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For what it's worth I had some problems with the ASP Project in Chapter 14 also. After wasting a lot of time trying to debug and find the problem I finally was able to communicate with the author who sent me the latest version of the code. It works as advertised in this version. It appears he didn't upload the working version.

I have posted the version the author sent to me. It's on my website at "WebTutor.cc" Follow the download link to the C# download page. It is a self-extracting zip file.

Hope this helps.

Jim

Jim
  #7 (permalink)  
Old April 6th, 2004, 03:03 PM
Registered User
 
Join Date: Jan 2004
Location: Memphis, Tn, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You might take a look at an update I just posted on this issue.

Jim
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 14 Calendar Control sajhak ASP.NET 1.0 and 1.1 Basics 1 September 18th, 2006 12:11 PM
Chapter 14 Calendar webrobb BOOK: Beginning ASP.NET 1.0 7 August 28th, 2006 03:59 AM
Ch. 14 Calendar Modification Astalder BOOK: Beginning ASP.NET 1.0 6 December 1st, 2004 05:23 PM



All times are GMT -4. The time now is 05:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.