Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Grouped attachments in transformations View modes: 
User avatar
Member
Member
voladu - 11/6/2010 10:48:53 AM
   
Grouped attachments in transformations
Hi, everybody!
I look through docs and this site, but didn`t find how handle grouped attachments into transformations. This example from manual describes case with unsorted attachment.
I tried to put property AttachmentGroupGUID="Project Images" into this <cms:DocumentAttachments ID="ucDocAttachments" runat="server" TransformationName="cms.root.attachment" Path='<%# Eval("NodeAliasPath") %>' /> but it didnt helped.

User avatar
Member
Member
kentico_michal - 11/9/2010 3:38:01 AM
   
RE:Grouped attachments in transformations
Hi,

Well, the example from Developer’s guide is not intended to display grouped attachments. To achieve this you will need to use following code in your transformation:

<%@ Register Src="~/CMSModules/Content/Controls/Attachments/DocumentAttachments/DocumentAttachments.ascx" TagName="DocumentAttachments" TagPrefix="cms" %>


<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
CMS.SettingsProvider.DataClassInfo dci = CMS.SettingsProvider.DataClassInfoProvider.GetDataClass("cms.news");
if (dci != null)
{
CMS.FormEngine.FormInfo fi = new CMS.FormEngine.FormInfo(dci.ClassFormDefinition);
CMS.FormEngine.FormFieldInfo ffi = fi.GetFormField("FieldName");
Guid AttachmentGroupGUID = ffi.Guid;
this.ucAttachments.AttachmentGroupGUID = AttachmentGroupGUID;
this.ucAttachments.CultureCode = CMSContext.CurrentDocumentCulture.CultureCode;
this.ucAttachments.SiteName = CMSContext.CurrentSiteName;
this.ucAttachments.ReloadData(true);
}
}
</script>


Please do not forget to replace cms.news with the name of appropriate document type and FieldName with the name of field that you are using to store files.

Best regards,
Michal Legen