How can I display the file icon for files in a media library

'dipo Majekodunmi asked on April 11, 2017 01:23

I am currently using a media files data source and basic repeater to display files uploaded to a media library in Kentico 10. I would like to display the icons for the matching file type similar to what is obtainable with

<%# GetAttachmentIcon("FileAttachment")%>

for CMS.Files and Attachments.

Correct Answer

Jan Hermann answered on April 11, 2017 13:08

Please use the GetFileIcon method instead:

GetFileIcon returns an <i> tag displaying a font icon that represents the MIME type of the specified file extension.

<%# GetFileIcon(Eval("FileExtension")) %>

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.