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

Forums / Developing with Sitefinity / Getting the List Title in the Widget Template

Getting the List Title in the Widget Template

6 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    16 Jun 2011
    Link to this post
    How do I get the list title to showup in a list template

    ...not the title of each list item, but the list itself
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    20 Jun 2011
    Link to this post
    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
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    20 Jun 2011
    Link to this post
    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>
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    23 Jun 2011
    Link to this post
    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
  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    23 Jun 2011
    Link to this post
    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?
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    28 Jun 2011
    Link to this post
    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
6 posts, 0 answered