Retrieving url provided by sf:DetailsViewHyperLink - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Retrieving url provided by sf:DetailsViewHyperLink

  • Retrieving url provided by sf:DetailsViewHyperLink
  • 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.

  • 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:"

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

    Kristian Smilenov
    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
  • 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")%>'/>