1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / NewsItems and Comments

NewsItems and Comments

2 posts, 1 answered
  1. Tony
    Tony avatar
    29 posts
    Registered:
    30 Dec 2010
    17 Oct 2011
    Link to this post
    I am attempting to get a listing of all of the published NewsItems and the comments that have been posted in regards to them. I am returning all of the published NewsItems with the code below. However when I loop through the NewsItems the Comments.Count for the items are always zero. I have verified that there are many NewsItems that have published comments.

    As a side note I have also italicized and bolded a typo I have found when using the fluent API

    Thanks,

    Tony Concialdi

    Public Shared Function GetAllNewsFluent() As IQueryable(Of NewsItem)
            Return App.WorkWith().NewsItems().Publihed().[Get]()
    End Function


    Dim AllSitefinityNewsItems = GetAllNewsFluent()

    For Each item As NewsItem In AllSitefinityNewsItems
                Dim curNewsLink As New NewsLink
                curNewsLink.strURL = item.Urls(0).Url
                curNewsLink.intShares = item.Comments.Count

                If curNewsLink.intShares > 0 Then
                    NewsList.Add(curNewsLink)
                End If
    Next


  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    19 Oct 2011
    Link to this post
    Hi Tony,

    Please find attached a sample template which counts the number of comments for blog post programatically and displays them in a Literal control on the frontend, I hope you find it useful.



    Kind regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
2 posts, 1 answered