ASPX templates
Version 5.x > ASPX templates > Document Attachment Control - Transformation View modes: 
User avatar
Member
Member
seanbun - 3/15/2011 12:28:26 AM
   
Document Attachment Control - Transformation
How I could display multiple image stored in a document attachment control? What transformation method should I use?


User avatar
Certified Developer 8
Certified Developer 8
dvanbale - 3/15/2011 2:27:37 AM
   
RE:Document Attachment Control - Transformation
Hello Sean,

I recently also had this problem, however, with the help of Kentico support, I used this to retrieve a list of all the attachments of a field for the current page.

List<Guid> guidList = new List<Guid>();
Guid attachmentGroupguid = Guid.Empty;

DataClassInfo dci = DataClassInfoProvider.GetDataClass("CodeNameOfDocumentType");

if (dci != null)
{
FormInfo fi = new FormInfo(dci.ClassFormDefinition);
FormFieldInfo ffi = fi.GetFormField("FieldName");
attachmentGroupguid = ffi.Guid;
}

AttachmentManager am = new AttachmentManager();
DataSet ds = am.GetAttachments("AttachmentGroupGUID = '" + attachmentGroupguid.ToString() + "' AND AttachmentDocumentID = '" + CMSContext.CurrentDocument.DocumentID + "'", "AttachmentOrder", false);

Please let me know if this is satisfactory.

Regards,
dvanbale

User avatar
Member
Member
seanbun - 3/15/2011 5:32:22 PM
   
RE:Document Attachment Control - Transformation
Hi Dvanbale,

Thanks for you answer. It is awesome. It is definition worth to add to the documentation. I think the code is looking for the AttachmentGroupGUID from the ClassFormDefinition field in CMS_Class table and get all the attachments with that GUID in the CMS_Attachment table.

Cheers,

User avatar
Certified Developer 8
Certified Developer 8
dvanbale - 3/16/2011 4:21:12 AM
   
RE:Document Attachment Control - Transformation
Hello Sean,

I'm glad the solution worked out for you. I agree that this should be added to the Kentico documentation aswell, I've only been able to retrieve this information with the help from Kentico documentation.

Regards,
dvanbale

User avatar
Kentico Support
Kentico Support
kentico_radekm - 3/28/2011 4:35:26 PM
   
RE:Document Attachment Control - Transformation
Hello.

Thank you for your suggestion. I did submit it as possible documentation improvement and we will consider it.

Best Regards,
Radek Macalik