More in this section
Forums / Developing with Sitefinity / How to retrive number of comment, Taglist and categories of blogpost

How to retrive number of comment, Taglist and categories of blogpost

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Pravat
    Pravat avatar
    59 posts
    22 Jun 2010
    30 Aug 2011
    Link to this post
    Hi Team,
                  How to retrive Comment count, Categories list and Tagslist from blog post in my custom template. I want post should display like below. Please provide some sample template.

    'Title of Blog post'
    05/18/11 | 10 Comments | Tags: Natural Gas, South Africa, Mpumalanga plant

    Please help..

    Thanks & Regards,
    Pravat sharma.
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    02 Jan 2018
    02 Sep 2011
    Link to this post
    Hello Pravat,

    The comments count is displayed via a CommentsBox control, and for the Tags, you will need to add a FlatTaxonField control on your template. Basically this:
    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Comments" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Import Namespace="Telerik.Sitefinity" %>   
    <telerik:RadListView ID="Repeater" ItemPlaceholderID="ItemsContainer" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
            <sf:ContentBrowseAndEditToolbar ID="MainBrowseAndEditToolbar" runat="server" Mode="Add"></sf:ContentBrowseAndEditToolbar>
            <ul class="sfpostsList sfpostListTitleDateContent">
                <asp:PlaceHolder ID="ItemsContainer" runat="server" />
            <li class="sfpostListItem">
                <h2 class="sfpostTitle">
                    <sf:DetailsViewHyperLink TextDataField="Title" ToolTipDataField="Description" runat="server" />
                <div class="sfpostAuthorAndDate">
                    <asp:Literal ID="Literal2" Text="<%$ Resources:Labels, By %>" runat="server" />
                    <sf:PersonProfileView runat="server" />
                    <sf:FieldListView ID="PostDate" runat="server" Format=" | {PublicationDate.ToLocal():MMM dd, yyyy}" />
                <sf:FieldListView ID="PostContent" runat="server" Text="{0}" Properties="Content" WrapperTagName="div" WrapperTagCssClass="sfpostContent" />
                <sf:CommentsBox ID="itemCommentsLink" runat="server" CssClass="sfpostCommentsCount"/>
                <div class="sfpostCategoriesAndTagsWrp">
                    <sitefinity:FlatTaxonField ID="FlatFieldControl" DisplayMode="Read" BindOnServer="true" runat="server" TaxonomyId="CB0F3A19-A211-48a7-88EC-77495C0F5374" WebServiceUrl="~/Sitefinity/Services/Taxonomies/FlatTaxon.svc" Expanded="false" TaxonomyMetafieldName="Tags" Title="Tags" ResourceClassId="TaxonomyResources" HideWhenNoTaxaFound="true" CssClass="sfpostTagsWrp" />
                <sf:ContentBrowseAndEditToolbar ID="BrowseAndEditToolbar" runat="server" Mode="Edit,Delete,Unpublish"></sf:ContentBrowseAndEditToolbar>
    <sf:Pager id="pager" runat="server"></sf:Pager>
    would display all the necessary infoprmation for your use case scenario, the rest should be some CSS styling (position:relative float:left) to display the tags and comments count on one line. This forum thread contains a discussion and code sample on a similar implementation, I believe you might find it useful.

    Boyan Barnev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

2 posts, 0 answered