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

Forums / Developing with Sitefinity / Need Help with Custom Widget Template

Need Help with Custom Widget Template

5 posts, 1 answered
  1. JingYuan
    JingYuan avatar
    12 posts
    Registered:
    18 Jul 2011
    21 Jul 2011
    Link to this post
    This is a Blog posts >> edit  >> List Setting >> myTemplate >> edit

    Source:

    Posted by <%# Eval("PostedBy")%> | category:
    <sitefinity:HierarchicalTaxonField ID="HierarchicalFieldControl" runat="server" TaxonomyId="E5CD6D69-1543-427b-AD62-688A99F5E7D4" DisplayMode="Read" WebServiceUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc" Expanded="false" TaxonomyMetafieldName="Category" ExpandText="ClickToAddCategories" BindOnServer="true" />
    | comments:

    Output: (category listed in multiple line)
    Posted by: Authorname | category:
    [Category 1]
    [Category 2]
    [Category 3]
    etc...
    | comments:

    What should I do to get the Output as: (all in 1 line)
    Posted by: Authorname | category: [Category 1] [Category 2] etc ... | comments:

    I tried <%# Eval("Category")%> but get "Telerik.OpenAccess.TrackedList`1[System.Guid]"
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    26 Jul 2011
    Link to this post
    Hi Jingyuan,

    You can easily achieve this functionality by applying a CSS rule to the categories list, please try the below sample:
    .sfCategoriesList li {
        position: relative;
        float: left;
        margin-right: 10px;
    }


    Best wishes,
    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
  3. JingYuan
    JingYuan avatar
    12 posts
    Registered:
    18 Jul 2011
    27 Jul 2011
    Link to this post
    Hi Boyan,

    The css did solved the ".sfCategoriesList" but still it does not solve the <sitefinity:HierarchicalTaxonField/>
    which seems to be doing a "<br />".

    This is the source:
    <%@ 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" %>   
     
    <style type="text/css">
    .sfCategoriesList li {
        position: relative;
        float: left;
        margin-right: 10px;
    }
    </style>
     
    <telerik:RadListView ID="Repeater" ItemPlaceholderID="ItemsContainer" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
        <LayoutTemplate>
            <sf:ContentBrowseAndEditToolbar ID="MainBrowseAndEditToolbar" runat="server" Mode="Add"></sf:ContentBrowseAndEditToolbar>
            <ul class="sfpostsList sfpostListTitleDateSummary">
                <asp:PlaceHolder ID="ItemsContainer" runat="server" />
            </ul>
        </LayoutTemplate>
        <ItemTemplate>
     
      <div id="content_text03">
          <strong><span class="content_textHeader">
            <sf:DetailsViewHyperLink TextDataField="Title" ToolTipDataField="Description" runat="server" />
          </span>
    <br />
    <br />
          </strong>
            <span class="content_posted">
    Posted By: <%# Eval("PostedBy")%> | category : <sitefinity:HierarchicalTaxonField ID="HierarchicalFieldControl" runat="server" TaxonomyId="E5CD6D69-1543-427b-AD62-688A99F5E7D4" DisplayMode="Read" WebServiceUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc" Expanded="false" TaxonomyMetafieldName="Category" ExpandText="ClickToAddCategories" BindOnServer="true" /> | Comments: <%# Eval("Comments.Count")%></span>
    <br />
    <br />
            <%# Eval("Summary")%>       
            <br />
            <br />
          <span><sf:DetailsViewHyperLink ID="FullStory" Text="read full post" runat="server" CssClass="sfpostFullStory" />
                <sf:ContentBrowseAndEditToolbar ID="BrowseAndEditToolbar" runat="server" Mode="Edit,Delete,Unpublish"></sf:ContentBrowseAndEditToolbar><br /><br />
    </span>
         </div>
         </div>
        </ItemTemplate>
     
    </telerik:RadListView>
    <sf:Pager id="pager" runat="server"></sf:Pager>


    This is the result:
    blogpost.jpg
  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    27 Jul 2011
    Link to this post
    Hello Jingyuan,

    Actually the control is not adding a</br> but is wrapped inside a <div> that's causing the problems. What you can do is apply the below CSS:
    .sys-template {
        display: none;
        position: relative;
    }
    .sfCategoriesList {
        display: inline;
    }
    .sfCategoriesList li {
        float: left;
        position: relative;
    }
    .sfpostAuthorAndDate div {
        display: inline;
        float: left;
        position: relative;
    }
    to display everything inline, and then wrap the Author name and "category:"  text in another <div> element  to avoid categories displaying before the author name like this:
    <div class="sfpostAuthorAndDate">
                <div><asp:Literal ID="Literal2" Text="<%$ Resources:Labels, By %>" runat="server" />
                <sf:PersonProfileView runat="server" /> category: </div>
    <sitefinity:HierarchicalTaxonField ID="HierarchicalFieldControl" runat="server" TaxonomyId="E5CD6D69-1543-427b-AD62-688A99F5E7D4" DisplayMode="Read" WebServiceUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc" Expanded="false" TaxonomyMetafieldName="Category" ExpandText="ClickToAddCategories" BindOnServer="true" />


    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
  5. JingYuan
    JingYuan avatar
    12 posts
    Registered:
    18 Jul 2011
    28 Jul 2011
    Link to this post
    Thank you for providing the all the assistance and info
5 posts, 1 answered