Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Search this Thread Display Modes
  #1 (permalink)  
Old February 11th, 2008, 06:19 AM
Authorized User
 
Join Date: Jun 2006
Location: Lahore, , Pakistan.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom Sorting for Comments

Hi everyone.
I’m confused about the custom sorting mechanism for the Article Comments in TBH. We have to display the comments on the ShowArticlePage in the chronological order without pagination. For this we can use “tbh_Article_GetCommentsByArticle” stored procedure. On the admin page, ManageComments, we have to display all the comments from newest to oldest with pagination support. For this we can use “tbh_Article_GetComments” stored procedure. Since we have two different SPs for these two pages, why don’t we just sort the results of “tbh_Article_GetCommentsByArticle“ SP from oldest to newest without pagination parameters and the results of “tbh_Article_GetComments” SP from newest to oldest with pagination parameters ? Why we need custom sorting mechanism in the Comment class?


  #2 (permalink)  
Old February 11th, 2008, 02:41 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

I agree with you -- for the functionality developed in the book, the CommentComparer class is not really necessary, as we are using the methods in question in only two places, and there is no need to reverse the order if you sort it they way you want directly in the SP. You'll also notice that CommentComparer allows for sorting by AddedBy as well as AddedDate, and that functionality is never used either.

I actually should say three places, as GetComments is also used in the Article class to define the Article.Comments property. However, I don't see a definite need to sort in descending order for that.

It is a good demonstration of how to implement IComparer though.

  #3 (permalink)  
Old February 14th, 2008, 07:07 AM
Authorized User
 
Join Date: Jun 2006
Location: Lahore, , Pakistan.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yep, I was thinking the same thing, its a good demonstration to implement IComparer, but I was wondering it didn't seem neccessary. Atleast I'm happy I wasn't missing anything.. thanks for your confirmation..!

 


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
Sorting Difficulties when implementing Custom Obj sandyl BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 12 July 28th, 2008 04:24 PM
Web Service, Custom Control, Custom Return Type robzyc ASP.NET 2.0 Basics 6 June 10th, 2008 08:03 AM
custom paging and sorting? asptwodev BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 September 22nd, 2007 02:06 AM
Comments janees ASP.NET 1.0 and 1.1 Professional 1 April 8th, 2007 09:27 PM
Datagrid sorting by non alphabetical sorting? LLAndy VS.NET 2002/2003 1 July 15th, 2004 01:20 AM



All times are GMT -4. The time now is 02:34 PM.


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