Try Now
More in this section

Forums / Developing with Sitefinity / Module builder- Related News

Module builder- Related News

2 posts, 0 answered
  1. Mansoor
    Mansoor avatar
    52 posts
    29 Jul 2013
    10 Jul 2015
    Link to this post


    I have created custom module "Main Slider"  with Related Media and Related News feilds  and etc.In the  widget template which display related images i would like to hyperlink to image it navigate to related news. I mean when user click image it will redirect to particular news item.

    I have tried to access  repeater within in repeater but doesn't work.

    I have shared VIDEO and Template code. Can you please show us/share us template code  how to get this .
    Really appreciate .


    Template Code:

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Comments" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Fields" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Comments.Web.UI.Frontend" TagPrefix="sf" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Import Namespace="Telerik.Sitefinity.Web.UI" %>
    <%@ Import Namespace="Telerik.Sitefinity.Modules.Comments" %>
    <%@ Import Namespace="Telerik.Sitefinity.RelatedData" %>
    <sf:SitefinityLabel id="title" runat="server" WrapperTagName="div" HideIfNoText="true" HideIfNoTextMode="Server" CssClass="sfitemFieldLbl" />
    <telerik:RadListView ID="dynamicContentListView" ItemPlaceholderID="ItemsContainer" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
           <div id="gallery">
                <asp:PlaceHolder ID="ItemsContainer" runat="server" />
          <div id="photo">
                                            <div class="photo_details" >
                                            <%--<sitefinity:TextField ID="TextField1" runat="server" DisplayMode="Read" Value='<%# Eval("summary")%>' />  --%>
                                                   <%--   <sf:FieldListView ID="summary" runat="server" Text="{0}" Properties="Summary" WrapperTagName="div"  EditableFieldType="Summary"/>  --%>
            <asp:Repeater runat="server" DataSource='<%# Eval("Image") %>'>
                                     <a href='<%# Eval("MediaUrl") %>' title='<%# Eval("MediaUrl") %>'  data-description= '<%# Eval("Title") %>'>
                                        <img src='<%# Eval("ThumbnailUrl")%>' alt='<%# Eval("AlternativeText")%>' title='<%# Eval("Title") %>' />
          <asp:Repeater runat="server" DataSource='<%# Eval("SelectNews") %>'>
                                <a href='<%# Telerik.Sitefinity.RelatedData.RelatedDataExtensions.GetDefaultUrl(Container.DataItem) %>' title='<%# Eval("Title") %>'></a>
    <sf:Pager id="pager" runat="server"></sf:Pager>
    <asp:PlaceHolder ID="socialOptionsContainer" runat="server"></asp:PlaceHolder>


    thank you 

  2. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    24 Jan 2017
    15 Jul 2015
    Link to this post
    Hello Mansoor,

    I have updated your support ticket on the subject. I will paste my reply here for your convenience as well.

    The only way to achieve this is to limit the related image and related news to only 1. After that you can use the code below in your template to display related image that links to the news article.
    Copy Code
    <href='<%# Telerik.Sitefinity.RelatedData.RelatedDataExtensions.GetDefaultUrl(Eval("SelectNews")) %>'>
                                <img src='<%# Eval("Image.MediaUrl")%>' alt='<%# Eval("Image.AlternativeText")%>' title='<%# Eval("Image.Title") %>' />

    Please keep in mind that updating widget templates will revert the templates to the default, so you may choose to backup the current ones first.

    Velizar Bishurov
    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
2 posts, 0 answered