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 February 11th, 2008, 06:19 AM
Authorized User
 
Join Date: Jun 2006
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?


 
Old February 11th, 2008, 02:41 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
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.

 
Old February 14th, 2008, 07:07 AM
Authorized User
 
Join Date: Jun 2006
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..!






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





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