Hi,
You're using the transformation code (marked with
<!-- document attachment code --> ) that is meant for the
DocumentAttachments control (linked in the 2nd row of the transformation), that will not work here.
In the transformation you posted, you are in the context of your custom document type, where the only available field related to attachments is the "sample" field (holding most probably the attachment GUID if a single attachment is used - i.e. not grouped attachments).
You cannot evaluate the attachment-specific fields like
Eval("AttachmentExtension") directly in your transformation - this field is just not available in this context.
You will either need to insert the
DocumentAttachments control into the transformation and set it's transformation to the default (
CMS.Root.AttachmentList) or other transformation which operates over the Attachment objects, not over your documents. You can see this case nicely explained in the
Handling attachments in transformations DevGuide article.
Or, you could use the methods for transformations to obtain the link (and icon) to the attachment directly from the single attachment field:
GetFileIconUrl(object attachmentGuidColumn)
example:
<%# GetFileIconUrl("sample") %>
Returns URL of the file type icon according to the extension of the file stored in the specified column.
GetFileUrl(object attachmentGuidColumn)
example:
<%# GetFileUrl("sample") %>
Returns URL of the file specified by the attachment GUID column of the given name.You can find the methods described in the
Transformation editor context help, available typically at
~/CMSHelp/index.html?newedit_transformation_methods.htmHope this will help.
Regards,
Zdenek