How to retrive number of comment, Taglist and categories of

Posted by Community Admin on 04-Aug-2018 13:53

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

All Replies

Posted by Community Admin on 30-Aug-2011 00:00

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.

Posted by Community Admin on 02-Sep-2011 00:00

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 >>

This thread is closed