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

Forums / Developing with Sitefinity / How to get latest 10 comments

How to get latest 10 comments

6 posts, 1 answered
  1. Milos Tadic
    Milos Tadic avatar
    32 posts
    Registered:
    05 Nov 2009
    03 Dec 2009
    Link to this post
    Hello to all,
    I use something like this to retrive comments list:

     
     
    Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager();   
    IList listOfComments = contentManager.GetComments("DateCreated DESC", 0, 10);   
    if (listOfComments.Count > 0)   
    {   
       foreach (Telerik.Cms.Engine.IComment commentItem in listOfComments)   
           literal.Text = commentItem.ToString();   
    }   
     
     

    <div id="commentList"
     
    <asp:Literal ID="literal" runat="server"></asp:Literal> 
     
    </div> 

    But, seems it's not working, for this I used tutorial FINDING Comments, but without result.
    Any suggestion?
    Thanks,
    Milos.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    03 Dec 2009
    Link to this post
    Hello Milos Tadic,

    Specify the provider name as a parameter of ContentManager

    Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager("Blogs");

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  3. Milos Tadic
    Milos Tadic avatar
    32 posts
    Registered:
    05 Nov 2009
    03 Dec 2009
    Link to this post
    Thanks a lot, it helped me.

    Best regards,
    Milos.
  4. Milos Tadic
    Milos Tadic avatar
    32 posts
    Registered:
    05 Nov 2009
    13 May 2010
    Link to this post
    Hellou, I have one more question in my old thread:
    How to add link for the entire comment for blog page where comment post?
    Here is my code:


    StringBuilder sb = new StringBuilder();
            Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager("Blogs");
            IList listOfComments = contentManager.GetComments("DateCreated DESC", 0,100);
            sb.Append ("<ul style='width:500px; color:#595959;margin-left:40px;' >");
           if (listOfComments.Count > 0)
            {
                foreach (Telerik.Cms.Engine.IComment commentItem in listOfComments)
                
                    sb.Append ("<li><b>" + commentItem.Owner + "</b> : " + commentItem.Text + "</li>");
                    //literal1.Text = commentItem.Owner + " : " + commentItem.Text;
                    //literal2.Text = commentItem.Owner + " : " + commentItem.Text;
                    //Response.Write(commentItem.Text + "<br /><br /><br />");
     
            }
            sb.Append("</ul>");
            komentari.Text = sb.ToString();
     
       }
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    13 May 2010
    Link to this post
    Hello Milos Tadic,

    You need to get the IComment - Parent which will return - IContent. The IContent object is the actual single blog post. IContent has a property - UrlWithExtension which you could use.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Milos Tadic
    Milos Tadic avatar
    32 posts
    Registered:
    05 Nov 2009
    13 May 2010
    Link to this post
    Thanks a lot Ivan.
    ----------------------------------
    Best regards,
    Milos Tadic.
Register for webinar
6 posts, 1 answered