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

Forums / General Discussions / Image Gallery - No Images

Image Gallery - No Images

3 posts, 0 answered
  1. David
    David avatar
    114 posts
    Registered:
    19 Jul 2012
    07 Jul 2015
    Link to this post
    Is there a simple way in the template to show a "no images" sign if your custom module has no images for that entry?
  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    02 Dec 2016
    10 Jul 2015
    Link to this post
    Hello David,

    What I can suggest is that you use the conditional control in the markup of your template and render data depending on a condition. The "If" attribute should contain a boolean value. Here is an example of how you can check if there are related items and if yes to render the related items and if there are no related items to render the desired text:

    <sf:Conditional If='<%# ((int)Eval("RelatedFieldName.Count")) != 0 %>' runat="server">
        <Then>
            <h2>Here are the related images</h2>
                        
            <asp:Repeater runat="server" DataSource='<%# Eval("RelatedFieldName") %>'>
    <ItemTemplate>                           
    <%-- here goes your custom logic for displaying the data for the related items --%>                             
              </ItemTemplate>
     </asp:Repeater>    
                                                      
        </Then>
        <Else>    
          <h2>There are no related images for this item.</h2>
        </Else>
    </sf:Conditional>

    Please note that the Conditional control is type of Telerik.Sitefinity.Web.UI and you need to register the namespace in your widget template in order to use it:

    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>

    Regards,
    Sabrie Nedzhip
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. David
    David avatar
    114 posts
    Registered:
    19 Jul 2012
    10 Jul 2015 in reply to Sabrie Nedzhip
    Link to this post

    Thanks Sabrie,

     Exactly the tool I needed.

3 posts, 0 answered