More in this section

Forums / Developing with Sitefinity / Show News Title and Content

Show News Title and Content

5 posts, 0 answered
  1. Denver Helpdesk
    Denver Helpdesk avatar
    1 posts
    Registered:
    10 Jun 2010
    01 Jul 2010
    Link to this post
    Hello,

    I am using a NewsView and the only "How to Organize News" option is "List & Page".  I would like to show the title as well as the full content of each news item all in the same page.  How might I accomplish this?  Thank you.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    01 Jul 2010
    Link to this post
    Hello Denver Helpdesk,

    Crate a custom control that inherits from NewsView. Inside ListPAgeMaster template of the control pit a Literla control

    <asp:Repeater ID="repeater" runat="server">
    ....
            ....
    <
    p>
        <asp:Literal ID="content" runat="server" ></asp:Literal>
    </p>

    Override SetItemMetadata method of your custom control. Call ItemContainer.FindControl("content")  and get reference to the control inside the template
    Set the text of the Literal control to contentItem.Content property. The itemContainer and contentItem are parameters of SetItemMetadata, so there would not be a problem to use them directly.

    Greetings,
    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
  3. Carl Leth
    Carl Leth avatar
    3 posts
    Registered:
    11 May 2010
    13 Jul 2010
    Link to this post
    This worked, except that Sitefinity links stay in their raw form, such as "/[Sitefinity]c36677c1-4993-4a39-bb9f-824c0f3f4505" instead of "/Home.aspx".  Is there an easy way to force Sitefinity to translate the content?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Jul 2010
    Link to this post
    Hello Carl Leth,

    You have to resolve the dynamic url - Resolving dynamic links

    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
  5. Carl Leth
    Carl Leth avatar
    3 posts
    Registered:
    11 May 2010
    13 Jul 2010
    Link to this post
    Thanks for the quick reply.  That worked great.  I added the GetItemUrl method in the post you linked, and hooked it up with:
    protected override void SetItemMetadata(Control itemContainer, Telerik.Cms.Engine.IContent contentItem)
    {
      base.SetItemMetadata(itemContainer, contentItem);
     
      var ctrl = itemContainer.FindControl("Content") as Literal;
     
      if (ctrl != null && contentItem != null && contentItem.Content != null)
      {
        ctrl.Text = LinkParser.ResolveLinks(contentItem.Content.ToString(), this.GetItemUrl);
      }
    }
Register for webinar
5 posts, 0 answered