Need Help with Custom Widget Template
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:
<%# Eval("Category")%>
but get "Telerik.OpenAccess.TrackedList`1[System.Guid]"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
;
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
>
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
;
<
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"
/>
Thank you for providing the all the assistance and info