Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > How to change the order in the comments list view View modes: 
User avatar
Member
Member
kentico-cadena-capriles - 1/13/2010 10:34:49 AM
   
How to change the order in the comments list view
Hi I would like change the order in the comments list view into the Blog Post.

By default its ordered from oldest to newest and i wolud like revert that order.

~/CMSModules/Blogs/Controls/BlogCommentView.ascx

<asp:Repeater ID="rptComments" runat="server" />

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 1/21/2010 9:40:41 AM
   
RE:How to change the order in the comments list view
Hello,

You can achieve this goal by adjusting the blog.comment.SelectForPost query in the database. Please find the CMS_Query table and amend the query in QueryText column.

There is following query:

SELECT ##TOPN## ##COLUMNS## FROM Blog_Comment WHERE CommentPostDocumentID = @CommentPostDocumentID AND (##WHERE##) ORDER BY ##ORDERBY##

Please change it like this:

SELECT ##TOPN## ##COLUMNS## FROM Blog_Comment WHERE CommentPostDocumentID = @CommentPostDocumentID AND (##WHERE##) ORDER BY CommentDate DESC

Please restart the system afterwards to take effect.

Best regards
Ondrej Vasil