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

Forums / General Discussions / Images in lists are not displaying on front end of website

Images in lists are not displaying on front end of website

9 posts, 0 answered
  1. Matt
    Matt avatar
    24 posts
    Registered:
    17 Sep 2009
    19 Oct 2011
    Link to this post
    When I add an image to a list item with either the upload or the select from already upload options it displays correctly in the cms but not on the font end of the website.

    On the front end it is outputting this:

    <img src="[images]50ee7335-3914-4708-a4e2-65dbf0c0b0ad" alt="Walter Johnson" style="float: left; margin-right: 10px; margin-bottom: 10px;">

    But it displays correctly when editing the list item on the back end:

    <img src="/images/content-images/walter-johnson.jpg" alt="Walter Johnson" style="float: left; margin-right: 10px; margin-bottom: 10px;" sfref="[images]50ee7335-3914-4708-a4e2-65dbf0c0b0ad" />

    I am using Build 4.2.1733
  2. Craig
    Craig avatar
    9 posts
    Registered:
    22 Feb 2011
    19 Oct 2011
    Link to this post
    Are you displaying the list content through a custom control?  If so, try this (it will return a string with the correct image src attributes):

    LinkParser.ResolveLinks(listItem.Content, DynamicLinksParser.GetContentUrl, null, false);
  3. Craig
    Craig avatar
    9 posts
    Registered:
    22 Feb 2011
    19 Oct 2011
    Link to this post
    Hm.  I just found the same behavior on my site (4.2sp1).  It looks like this is a bug in the list widgets.
  4. Matt
    Matt avatar
    24 posts
    Registered:
    17 Sep 2009
    19 Oct 2011
    Link to this post
    No I am just using the standard list controls.
  5. Craig
    Craig avatar
    9 posts
    Registered:
    22 Feb 2011
    19 Oct 2011
    Link to this post
    Here's my work around.  Hope you can use it too:

    1. Create a custom template for your widget (mine is in ~/CustomControls/ExpandableList.ascx).  Copy the markup from the existing List Template you're using.

    2. use this code in the code-behind:
    protected void Page_Load(object sender, EventArgs e)
            {
                listsControl.ItemDataBound += new EventHandler<Telerik.Web.UI.RadListViewItemEventArgs>(listsControl_ItemDataBound);
            }
     
            void listsControl_ItemDataBound(object sender, Telerik.Web.UI.RadListViewItemEventArgs e)
            {
                if (e.Item.ItemType == RadListViewItemType.AlternatingItem || e.Item.ItemType == RadListViewItemType.DataItem)
                {
                    var listsItemsControl = e.Item.FindControl("listItemsControl") as RadListView;
                    listsItemsControl.ItemDataBound += new EventHandler<RadListViewItemEventArgs>(listsItemsControl_ItemDataBound);
                }
     
            }
     
            void listsItemsControl_ItemDataBound(object sender, RadListViewItemEventArgs e)
            {
                if (e.Item.ItemType == RadListViewItemType.AlternatingItem || e.Item.ItemType == RadListViewItemType.DataItem)
                {
                    var lit2 = e.Item.FindControl("Literal2") as Literal;
                    var listItem = ((RadListViewDataItem) e.Item).DataItem as Telerik.Sitefinity.Lists.Model.ListItem;
                    lit2.Text = LinkParser.ResolveLinks(listItem.Content, DynamicLinksParser.GetContentUrl, null, false);
                }
            }

    That will put the listItem content through the link parser.

    3. Go to the page with the widget, Edit the Widget properties
    4. Delete the value for MasterTemplateId
    5. Enter the path to your new control in LayoutTemplatePath (~/CustomControls/ExpandablePath.ascx)


    Craig
  6. Matt
    Matt avatar
    24 posts
    Registered:
    17 Sep 2009
    19 Oct 2011
    Link to this post
    Thanks, I will give that a try.
  7. Jen Peleva
    Jen Peleva avatar
    568 posts
    Registered:
    10 Nov 2016
    21 Oct 2011
    Link to this post
    Hello Matt,

    Thank you for contacting Telerik support.

    It is quite possible that the issue comes from a bug which was fixed in 4.2. SP1 (Page links are not resolved properly when a project is accessible from two different domains, and of them is a sub-directory of the other &ndash; PITS).
    I'm sending you a patched Telerik.Sitefinity.Model.dll, which should solve the problem. You need to replace the same file in your ~/bin folder. The fix will be also included in the next release. Sorry for the inconvenience.

    Let me know if you have any further questions.


    Regards,
    Jen Peleva
    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
  8. Manisha
    Manisha avatar
    1 posts
    Registered:
    29 Dec 2011
    29 Dec 2011
    Link to this post
    hello i have also same problem thai is value is displayed at back end but not to the front end.
  9. Jen Peleva
    Jen Peleva avatar
    568 posts
    Registered:
    10 Nov 2016
    29 Dec 2011
    Link to this post
    Hi Manisha,

    Did you try what I proposed in my previous post?

    All the best,
    Jen Peleva
    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
9 posts, 0 answered