More in this section

Forums / Developing with Sitefinity / Document Selection in News Item

Document Selection in News Item

2 posts, 1 answered
  1. KMac
    KMac avatar
    133 posts
    Registered:
    15 Dec 2008
    11 Mar 2010
    Link to this post
    Hello,

    I've added a metafield called PDFAttachment to the NewsItemEdit and NewsItemNew views, added a buttonSelector like so:

     

     

     

    <asp:TextBox ID="PDFAttachment" Text="" runat="server" MaxLength="250"></asp:TextBox 
      
    <sfLib:ButtonSelector ID="ButtonSelector1" WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/DocumentEditorDialog.aspx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="PDFAttachment" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />

     

     


    When inserting a news item, I can select a document just fine, but what's returned is a [Library]GUID entry. Is there an easy way to return the path to the file instead or parse it on the public side?

    My public side Master/Detail templates are just using a Hyperlink like so:

     

    <asp:HyperLink ID="pdfAttachment2" runat="server" NavigateUrl='<%#Eval("PDFAttachment", "~/{0}") %>'><asp:Literal ID="Title" runat="server"></asp:Literal></asp:HyperLink>

    I just don't know what to do with the GUID to turn it into a workable link.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Mar 2010
    Link to this post
    Hello KMac,

    This is a dynamic link. You can resolve it following this blog post - Resolving the url of dynamic links. You can create additional hidden metakey where you set the resolved value and then perform binding using the hidden metakey.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
2 posts, 1 answered