More in this section

Forums / Developing with Sitefinity / Custom ListDisplay

Custom ListDisplay

2 posts, 1 answered
  1. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    10 Jul 2010
    Link to this post
    I want to display my list in a way where the titles are on the left and the main text of a selected item is on the right.
    There does not apear to be any template that does this.

    I tried creating a custom template, but am unsure how to go about it.
    I can get the list of titles to display having taken the code from the PageListView template:

    <asp:Repeater ID="lists" runat="server">
        <ItemTemplate>
            <h2 class="sf_listTitle">
                <asp:Literal ID="listTitle" runat="server" />
            </h2>
            <ul class="sf_pageList">
                <asp:Repeater ID="listItems" runat="server">
                    <ItemTemplate>
                        <li>
                            <asp:LinkButton ID="headline" runat="server"></asp:LinkButton>
                        </li>
                    </ItemTemplate>
                </asp:Repeater>
            </ul>
        </ItemTemplate>
    </asp:Repeater>

    However i am not sure how to get the main text of the item to display when clicking on an item.

    Can anyone help me with this?

    Thanks

    A
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Jul 2010
    Link to this post
    Hello Andrew,

    The easiest way that you can achieve this setting style to the inner repeater of ListsDisplay control.

    Then add a new control, say Literal which will display the content of the clicked List item. You can use JQuey .html() to get the html contents (innerHTML) from the repaater control which will be bound. After you have the html value you can set it as a text of the Literal control.

    In the list you are going to have many items so you need to create a custom ListsDisplay control and access the inner repeater.Then get the id of the generated elements in the <ul>. You have to get the anchor element and set OnClick function.Then in your template you can use jQuery to set the text of the Literal.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
2 posts, 1 answered