Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 23rd, 2009, 02:19 PM
Authorized User
 
Join Date: Sep 2009
Posts: 23
Thanks: 9
Thanked 1 Time in 1 Post
Default Chapter 16 Page 576 Question

Imar,

Quick question. To quote your book on page 576 right below figure 16-8 it says "If you haven't set any preferred genres, or none of them contain any reviews or you're no logged in, you get the message shown in Figure 16-9." I noticed the following two things:

1. The message in Figure 16-9 contains a different text string then what was entered within the PlaceHolder at the top of page 575. No biggie here, just bringing it to your attention.

2. More importantly, I didn't get the said message for preferred genres that didn't contain any reviews. To test this, I explicitly selected genres that didn't have any reviews as my preference and requested the page. The genres showed up boldface with no reviews underneath them. Shouldn't I have gotten the message instead?

Additionally, even when some preferred genres had reviews and others did not, the ones that didn't still showed up boldface as in Figure 16-8 on page 576. I got the impression that if there is no reviews for a preferred genre, then that genre shouldn't end up on the page all together.

Any thoughts on this would be greatly appreciated.

Thanks,

John
Reply With Quote
  #2 (permalink)  
Old September 23rd, 2009, 04:45 PM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Regarding #1: yes, correct. The image doesn't correctly reflect the text you entered in step 2. I'll have that added to the errata section. But as you say, no biggie.

#2: I can see where the confusion comes from. Basically, when you have selected at least one genre in the Profile page, it shows up on that page, regardless of the number of reviews attached to it. So, you may see seven emtpty genres with no reviews if you selected those on the profile page. This was more or less intended / by design.
I can see how your idea is more natural. Fortunately, it's easy to implement. Just limit the Genres to those that have at least one review:

Code:
var favGenres = from genre in myDatabaseContext.Genres
                     orderby genre.Name
                     where Profile.FavoriteGenres.Contains(genre.Id)
                     && genre.Reviews.Count() > 0
                     select new { genre.Name, genre.Reviews };
Now, when a Genre does not have a Review, it won't show up in the list. This in turn means you see the message if no review (and thus no empty Genre header) shows up.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Last edited by Imar; September 23rd, 2009 at 04:48 PM..
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
jsymons (September 23rd, 2009)
  #3 (permalink)  
Old September 23rd, 2009, 06:12 PM
Authorized User
 
Join Date: Sep 2009
Posts: 23
Thanks: 9
Thanked 1 Time in 1 Post
Default

Imar,

An easy fix indeed to get that behavior. I just had to convert the one line in your C# example from && genre.Reviews.Count() > 0 to And genre.Reviews.Count > 0 _ because my code was written in VB.

Thanks again,

John
Reply With Quote
  #4 (permalink)  
Old September 25th, 2009, 03:20 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Excellent, glad it's working...

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 16 Try It Out Page 498 Step 7 workib BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 1 October 9th, 2008 08:22 PM
Error code: Chapter 17 Pag 576 luisxvarg BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 October 15th, 2007 08:06 PM
Chapter 1 Page 16 - Try It Out bradnerdhss BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 January 31st, 2006 02:11 PM
Chapter 16 Question SomeDude BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 4 October 24th, 2005 06:13 PM



All times are GMT -4. The time now is 05:49 PM.


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