I put it in the main-folder and it works. Still have to try if it works on the server as well, but otherwise I can try putting it on the Old_App_Code-folder, thanks for that! And thanks for the link.
I got it working with the following code:
Transformation:
<%@ Register TagPrefix="cc1" Namespace="CMS.GlobalHelper" Assembly="CMS.GlobalHelper" %>
<div id="divAttachmentCSS">
<a target="_blank" href="<%# GetAbsoluteUrl(GetAttachmentUrl(Eval("AttachmentName"), Eval("NodeAliasPath")), Eval<int>("AttachmentSiteID")) %>">
<%# CMSApp.MyFunctions.GetAttachmentTitle(Eval("AttachmentGuid").ToString(),Eval("AttachmentName").ToString()) %>
</a>
</div>
MyFunctions class, GetAttachmentTitle:
public static string GetAttachmentTitle(string attachmentGUID, string attachmentName)
{
try
{
AttachmentManager am = new AttachmentManager();
AttachmentInfo info = am.GetAttachmentInfo(attachmentGUID, "MySiteName");
if (info.AttachmentTitle == "")
{
return attachmentName;
}
return info.AttachmentTitle;
}
catch (Exception)
{
return attachmentName;
}
}