Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2009, 10:52 PM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 119
Thanks: 26
Thanked 0 Times in 0 Posts
Default where do the stars ratings load from?

I haven't been able to figure out where the stars(beer mugs) images for the ratings load from. There's no reference to them by name in the solution. And I couldn't find any link to their names in the database.



Rachel
 
Old January 15th, 2009, 12:58 PM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 119
Thanks: 26
Thanked 0 Times in 0 Posts
Default

I never get any answers here.
 
Old January 15th, 2009, 03:40 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

All of that logic is encapsulated in the RatingsDisplay.ascx user control.

Look at the setter for the Value property.


Code:
      public double Value
      {
         get { return _value; }
         set
         {
            _value = value;
            if (_value >= 1)
            {
               lblNotRated.Visible = false;
               imgRating.Visible = true;
               imgRating.AlternateText = "Average rating: " + _value.ToString("N1");
               string url = "~/images/stars{0}.gif";
               if (_value <= 1.3)
                  url = string.Format(url, "10");
               else if (_value <= 1.8)
                  url = string.Format(url, "15");
               else if (_value <= 2.3)
                  url = string.Format(url, "20");
               else if (_value <= 2.8)
                  url = string.Format(url, "25");
               else if (_value <= 3.3)
                  url = string.Format(url, "30");
               else if (_value <= 3.8)
                  url = string.Format(url, "35");
               else if (_value <= 4.3)
                  url = string.Format(url, "40");
               else if (_value <= 4.8)
                  url = string.Format(url, "45");
               else
                  url = string.Format(url, "50");
               imgRating.ImageUrl = url;
            }
            else
            {
               lblNotRated.Visible = true;
               imgRating.Visible = false;
            }
         }
      }
As you can see, the string for imgRating.ImageUrl is built from the series of -if- statements, and is based on the incoming setter value.

For example, let's say the Value was 2.1. That would bring you down to this branch:

Code:
else if (_value <= 2.3)
   url = string.Format(url, "20");
That would create a string of "~/images/stars20.gif". That is what imgRating.ImageUrl would be set to.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
Rachel (January 15th, 2009)
 
Old January 15th, 2009, 03:42 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Quote:
Originally Posted by Rachel View Post
I never get any answers here.
That might be because we are waiting to see if you can figure it out on your own...
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old January 15th, 2009, 04:04 PM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 119
Thanks: 26
Thanked 0 Times in 0 Posts
Default

Thanks Lee.
I guess that is the one file I didn't see or search. I thought I had looked everywhere. And I did a search for stars10, etc. so that's why I didn't find it.
Mystery solved.

Best,

Rachel
 
Old January 15th, 2009, 06:59 PM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 119
Thanks: 26
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Lee Dumond View Post
That might be because we are waiting to see if you can figure it out on your own...

Well, I've spun my wheels on this fckeditor now for more than a day. I don't think I can figure it out. Have mercy on a poor newbie... Maybe you'll take a look at that post? (link below)??

FCKeditor (original beerhouse version) errors

Rachel





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error during load neetagp_21 Beginning VB 6 0 February 21st, 2007 02:16 AM
levels for the small stars crmpicco Forum and Wrox.com Feedback 2 December 5th, 2006 05:33 AM
"fill" is different from "load" salemkoten Visual Studio 2005 0 October 23rd, 2006 04:24 AM
load picture Jon Pro VB Databases 0 September 12th, 2004 09:36 AM
How do I load a file? Loevet J2EE 2 October 30th, 2003 04:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.