ASPX templates
Version 5.x > ASPX templates > Displaying file information such as size etc View modes: 
User avatar
Member
Member
chris.percival-oakwood-dc - 5/6/2010 8:59:39 AM
   
Displaying file information such as size etc
I have the following code displaying a list of files at the path "/Files/%". I have a custom transformation 'CMS.File.FileInfo', in which I want to display things like filetype icon, file size, modified date etc. I can create a link to it easily with <%# GetDocumentLink() %>, but anything more is beyond me.


<cms:CMSDocumentsDataSource EnableViewState="false" Path="/Files/%" ID="documentsDataSource"
ClassNames="CMS.File" runat="server" />

<cms:CMSDataList ID="ucDatalist" runat="server"
TransformationName="CMS.File.FileInfo"
ZeroRowsText="No data found" EnableViewState="false" />


As this seems to be quite difficult, am I going about this the wrong way? Is there some combination of controls etc that could do this for me?

User avatar
Member
Member
chris.percival-oakwood-dc - 5/7/2010 3:00:59 AM
   
RE:Displaying file information such as size etc
Got the file icon sorted using this undocumented feature:

<%# GetFileIconUrl("FileAttachment") %>

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 5/7/2010 3:49:24 AM
   
RE:Displaying file information such as size etc
Hi,

Yes, sure. You need to create custom transformation function for this purpose. Following KB articles will help you:

http://devnet.kentico.com/Knowledge-Base/API-and-Internals/How-to-display-file-size-%28attachment-size%29-on-a-pa.aspx
http://devnet.kentico.com/Knowledge-Base/API-and-Internals/How-to-get-data-of-document-attachment-using-API.aspx

Attachments are stored in CMS_Attachment table in database, you can then use any field from this table in your custom transformation function when using AttachmentInfo object.

Best regards,
Miroslav Remias.

User avatar
Member
Member
chris.percival-oakwood-dc - 5/7/2010 4:06:19 AM
   
RE:Displaying file information such as size etc
Ah that's brilliant, thank you!!