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

Forums / Developing with Sitefinity / Retrieving url provided by sf:DetailsViewHyperLink

Retrieving url provided by sf:DetailsViewHyperLink

3 posts, 0 answered
  1. Loris
    Loris avatar
    2 posts
    Registered:
    26 Nov 2013
    16 Apr 2014
    Link to this post

    Hi,

    I got a custom Module with a media field.

    In my AssetField Control, I would like to create a link to the default Page (same link as sf:DetailsViewHyperLink) if the media field is not filled.

    How can I get the url provided by "sf:DetailsViewHyperLink" control?

    Thanks for your help.

  2. Kristian Smilenov
    Kristian Smilenov avatar
    32 posts
    Registered:
    18 Mar 2015
    21 Apr 2014
    Link to this post
    Hello Loris,

    Can you please elaborate a little bit more on your case - What do you mean by "a link to the default Page" - the canonical URL of the item or the hyperlink to details view for current ContentView control?

    If you want to put an extra link in the template of the Assets Field, you will have to create a custom field extending the current ImageAssetsField and add it to the template, and then add a DetailsViewHyperLink there.

    It comes to my sight that you are using Sitefinity 7.0. Does this mean that you are using the Related media field? If this is the case, please check the following paragraph of the upcoming Related Data documentation:   

    "By default Related Images are displayed via an Images View that auto generated in the item template for dynamic modules but should be manually inserted for static modules. If, however, you need to display the images simply in a Repeater, you can use the Related Data API and add the following to the template:"


    <div>
      <ul>
          <asp:Repeater runat="server" DataSource='<%# Container.DataItem.GetRelatedItems("SponsorLogos") %>'>
        <ItemTemplate>
            <li><a href='<%# Eval("MediaUrl") %>'>
            <img height="95" src="<%# Eval("ThumbnailUrl")%>" alt="<%# Eval("AlternativeText")%>" id="<%# Eval("Id") %>" title="<%# Eval("Title") %>" >
                </a></li>
        </ItemTemplate>
         </asp:Repeater>
      </ul>
    </div>
     
    Note: You should import the following namespace:
    <%@ Import Namespace="Telerik.Sitefinity.RelatedData" %>
    <%@ Import Namespace="Telerik.Sitefinity.Libraries.Model" %>


    Regards,
    Kristian Smilenov
    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. Loris
    Loris avatar
    2 posts
    Registered:
    26 Nov 2013
    29 Apr 2014 in reply to Kristian Smilenov
    Link to this post

    Hello Kristian,

    Thank you for your answer.

    I created a new module called "Specific News" with a media field (file), a text zone, etc.

    In the widget template which displays the list of "Specific News", I would like to use the link provided by the "sf:DetailsViewHyperLink" control if the media field is not filled.

    I don't know if this is possible. But anyway I found another way to do what I would like :

    <sf:DetailsViewHyperLink ID="DetailsViewHyperLink" TextDataField="Title" runat="server" Visible='<%# (Eval("Content") == null || Eval("Content").Equals(string.Empty)) ? false : true %>'  /><uc:AssetsFieldCustom ID="customAssetsField" runat='server' DataFieldName='pdf_File' Visible='<%# (Eval("Content") == null || Eval("Content").Equals(string.Empty)) ? true : false %>'  Description='<%# Eval("Title")%>'/>

3 posts, 0 answered