More in this section
Forums / Designing & Styling / Problem modifying list template

Problem modifying list template

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Jeff
    Jeff avatar
    4 posts
    11 Mar 2013
    17 Jun 2013
    Link to this post
    I am new to Sitefinity and working on getting a better understanding of the widget templates and how to modify them.   I am trying to modify the "Titles only" list template (List items - Simple list) and having problems with a custom field that I added to the list.    I added a custom field called "PhoneNumber"  of type "Short text".  I copied the widget template code to the "Titles only" template mentioned above and created a new template called "Titles and Phone Number".  So far so good.  My problem and confusion is related to my custom field "PhoneNumber"   Below is my customized template.  The Eval of PhoneNumber on line 19 does not work and I get a "Error parsing the template" message when I try to use the template. If I change line 19 to reference the "Title" field (or remove it all together), the Eval of PhoneNumber on line 35 works without issue.  I'm sure there is something trivial that I just don't understand, but I am confused why there is an issue with the Eval on line 19 and not on line 35.  Can someone explain what I am doing wrong ?

    Thanks in advance for your help -- Jeff Gaiche

    01.<%@ Control Language="C#" %>
    02.<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    03.<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
    06.        id="listsControl"
    07.        runat="server"
    08.        ItemPlaceholderId="ListContainer"
    09.        EnableEmbeddedSkins="false"
    10.        EnableEmbeddedBaseStylesheet="false">
    11.    <LayoutTemplate>
    12.        <div class="sfsimpleListWrp">
    13.            <asp:PlaceHolder id="ListContainer" runat="server" />
    14.        </div>
    15.    </LayoutTemplate>
    16.    <ItemTemplate>
    17.        <h2 class="sflistTitle">
    18.          <asp:Literal runat="server" Text='<%# Eval("Title") %>' />
    19.          <asp:Literal runat="server" Text='<%# Eval("PhoneNumber") %>' />         
    20.        </h2>
    21.        <telerik:RadListView
    22.                ID="listItemsControl"
    23.                runat="server"
    24.                ItemPlaceholderID="ItemsContainer"
    25.                EnableEmbeddedSkins="false"
    26.                EnableEmbeddedBaseStylesheet="false">
    27.            <LayoutTemplate>
    28.                <ul class="sflistList">
    29.                    <asp:PlaceHolder ID="ItemsContainer" runat="server" />
    30.                </ul>
    31.            </LayoutTemplate>
    32.            <ItemTemplate>
    33.                <li class="sflistListItem">
    34.                  <asp:Literal runat="server" Text='<%# Eval("Title") + "     " %>' />
    35.                  <asp:Literal runat="server" Text='<%# Eval("PhoneNumber")%>' />                 
    36.                </li>
    37.            </ItemTemplate>
    38.        </telerik:RadListView>
    39.    </ItemTemplate>
    41.<asp:PlaceHolder ID="socialOptionsContainer" runat="server" />
  2. Veselin Vasilev
    Veselin Vasilev avatar
    23 posts
    27 Jul 2015
    19 Jun 2013
    Link to this post
    Hi Jeff,

    I suppose you are working with either Simple list or Page List as shown below:

    Let me try to explain why is this happening:
    The template you are working on has 2 RadListView controls - the first one shows a list of all Lists and the second shows the individual items for each list. That's why you can use the PhoneNumber custom field only in the second RadListView - because it knows the data/fields of the list items, whereas the first RadListView knows only about the Lists, nothing about their items. Since the PhoneNumber field is on an Item level - you can use it only in the second RadListView. 

    I hope this make sense. Please let me know if there is anything I can help you with.

    Veselin Vasilev
    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
2 posts, 0 answered