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

Forums / Bugs & Issues / Using Dynamic Image Paths in List - 3.7 SP2

Using Dynamic Image Paths in List - 3.7 SP2

2 posts, 0 answered
  1. Solomon
    Solomon avatar
    10 posts
    Registered:
    12 Feb 2008
    19 Jan 2010
    Link to this post
    Sitefinity 3.7 SP2.

    Whenever I add an image to a List (we sometimes use lists to drive things like image carousels, etc.), the HTML output comes back with the SFREF image ID. I know that this is because I am custom outputting this HTML (see below) and the url is not resolving. Anyone have any ideas on how to do this? I have included all the relevant code here.

    Here is my HTML in my List Item
    <href="/Products/OutsourcingServices.aspx"><img sfref="[Libraries]56fe21a8-1b9e-495a-abbf-51d03a3de048" runat="server" src="/Libraries/Subpage_Carousel_Images/Outsourced_Services.sflb.ashx" alt="Outsourced Services" /></a

    Here is the output on the page
    <ul id="carousel_ul"><li><a href="/Products/OutsourcingServices.aspx"><img alt="Outsourced Services" src="[Libraries]56fe21a8-1b9e-495a-abbf-51d03a3de048" runat="server" /></a
    </li><li>...</li></ul

    I am using custom code to output my HTML from the codebehind.
    private void BuildSubpageCarousels() 
        { 
            var listManager = new Telerik.Lists.ListManager(); 
            var html = new System.Text.StringBuilder(); 
     
            //ID of the "Subpage Carousel Content" list is 9831da5d-4a72-4147-bf74-498f73d5348c 
            INamedList list = GetListByID("9831da5d-4a72-4147-bf74-498f73d5348c"); 
     
            if (list != null
            { 
                IList listItems = listManager.GetListItems(list); 
     
                int iCount = 1; 
     
                foreach (Telerik.Lists.IListItem listItem in listItems) 
                { 
                    if (iCount != listItems.Count) 
                    { 
                        html.Append(string.Format("<li>{0}</li>", listItem.Content)); 
                    } 
                    iCount++; 
                } 
     
                phCarousel.Controls.Add(new LiteralControl(html.ToString())); 
            } 
        } 

    This gets outputted to a placeholder with the ul tags around it.
     <div id="carousel_inner"
                            <ul id="carousel_ul"
                                <asp:placeholder id="phCarousel" runat="server"></asp:placeholder> 
                            </ul> 
                        </div> 

    Any insight would be appreciated. Thanks to all the awesome people on this forum.

    Solomon
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Jan 2010
    Link to this post
    Hi Solomon,

    You have to resolve the [Provider]Guid. You may find this post useful.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered