Getting the List Title in the Widget Template

Posted by Community Admin on 04-Aug-2018 03:01

Getting the List Title in the Widget Template

All Replies

Posted by Community Admin on 16-Jun-2011 00:00

How do I get the list title to showup in a list template

...not the title of each list item, but the list itself

Posted by Community Admin on 20-Jun-2011 00:00

Hi Steve,

Can you please let us know which template are you using so that we can give you more specific details? In general you can create a custom template and bind to the ItemDataBound event of the RadListView. In the event check if e.Item is RadListDataItem, if it is cast it to RadListDataItem and get the list object by casting the DataItem property of the RadListDataItem object to ListItem. From there on you can get the Parent and its Title property.

All the best,
Radoslav Georgiev
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

Posted by Community Admin on 20-Jun-2011 00:00

Hey Radoslav,
  I guess I mean ANY of the widget templates in the backend, but lets go with Simple List Content only

So the desired look is

LIST NAME
  - listitem1 content
  - listitem2 content
  - listitem3 content

I tried adding an Eval to the Layout template, but it borked the template


<%@ Control Language="C#" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
 
<telerik:RadListView
        id="listsControl"
        runat="server"
        ItemPlaceholderId="ListContainer"
        EnableEmbeddedSkins="false"
        EnableEmbeddedBaseStylesheet="false">
    <LayoutTemplate>
        <div class="sfsimpleListWrp">
            <asp:PlaceHolder id="ListContainer" runat="server" />
        </div>
    </LayoutTemplate>
    <ItemTemplate>
        <telerik:RadListView
                ID="listItemsControl"
                runat="server"
                ItemPlaceholderID="ItemsContainer"
                EnableEmbeddedSkins="false"
                EnableEmbeddedBaseStylesheet="false">
            <LayoutTemplate>
                <ul class="sflistList">
                    <asp:PlaceHolder ID="ItemsContainer" runat="server" />
                </ul>
            </LayoutTemplate>
            <ItemTemplate>
                <li class="sflistListItem">
                    <sitefinity:HtmlField runat="server" DisplayMode="Read" Value='<%# Eval("Content")%>' />
                </li>
                <sf:ContentBrowseAndEditToolbar ID="BrowseAndEditToolbar" runat="server" Mode="Edit,Delete,Unpublish"></sf:ContentBrowseAndEditToolbar>
            </ItemTemplate>
        </telerik:RadListView>
    </ItemTemplate>
</telerik:RadListView>

Posted by Community Admin on 23-Jun-2011 00:00

Hello Steve,

It seems that you are using an older template. The new ones have the title already. Take a look at the markup. There are 2 nested RadListView controls. The first one displays the List, the second one its items. So if you put the eval right before the second list view you will see the title:

<%@ Control Language="C#" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
 
<telerik:RadListView
        id="listsControl"
        runat="server"
        ItemPlaceholderId="ListContainer"
        EnableEmbeddedSkins="false"
        EnableEmbeddedBaseStylesheet="false">
    <LayoutTemplate>
        <div class="sfsimpleListWrp">
            <asp:PlaceHolder id="ListContainer" runat="server" />
        </div>
    </LayoutTemplate>
    <ItemTemplate>
        <h2 class="sflistTitle">
            <asp:Literal runat="server" Text='<%# Eval("Title") %>' />
        </h2>
        <telerik:RadListView
                ID="listItemsControl"
                runat="server"
                ItemPlaceholderID="ItemsContainer"
                EnableEmbeddedSkins="false"
                EnableEmbeddedBaseStylesheet="false">
            <LayoutTemplate>
                <ul class="sflistList">
                    <asp:PlaceHolder ID="ItemsContainer" runat="server" />
                </ul>
            </LayoutTemplate>
            <ItemTemplate>
                <li class="sflistListItem">
                    <asp:Literal runat="server" Text='<%# Eval("Title") %>' />
                    <sf:ContentBrowseAndEditToolbar ID="BrowseAndEditToolbar" runat="server" Mode="Edit,Delete,Unpublish"></sf:ContentBrowseAndEditToolbar>
                </li>
            </ItemTemplate>
        </telerik:RadListView>
    </ItemTemplate>
</telerik:RadListView>


Regards,
Radoslav Georgiev
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

Posted by Community Admin on 23-Jun-2011 00:00

Ok perfect thanks...hey let me ask you this though

How will we know templates have updates that need to be applied for each update?

Posted by Community Admin on 28-Jun-2011 00:00

Hi Steve,

You can check the changes with win merge and compare your version the files with the latest ones from the archive of control templates which comes with the SDK.

Greetings,
Radoslav Georgiev
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

This thread is closed