More in this section

Forums / Developing with Sitefinity / Comments Count

Comments Count

2 posts, 0 answered
  1. Gökhan Yalçın
    Gökhan Yalçın avatar
    21 posts
    26 Nov 2009
    02 Feb 2010
    Link to this post
    Hi ,

    How can i show the total number of comments in the news detail page.

    Thanks in advance
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    02 Feb 2010
    Link to this post
    Hello Gökhan Yalçın,

    This line will return all comments for a given content item

    IList commentsList = ContentManager.Providers["Blogs"].GetComments(new Guid("4FCECC6E-CE2B-4A87-9006-0CC0C6ECAE06"), true, string.Empty);
    int count = commentsList.Count;

    You can get the content item id by creating a custom class that inherits from NewsView and add the logic inside SetItemMetaData method which you have to override to get access to the content item object.

     Best wishes,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
2 posts, 0 answered