ASPX templates
Version 5.x > ASPX templates > attribute type 'document attachment' in doc type View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
adam-syndicut - 4/16/2010 11:48:20 AM
   
attribute type 'document attachment' in doc type
Hi i'm using the document attachment type in a doc type so images can be uploaded.

Attribute name: property_images
field caption: Images

in my aspx page i am trying to use one of the webparts found in CMSWebParts\Attachments\

i then use this as a control on my page adding the reference at the top etc so i have
<%@ Register Src="~/CMSWebParts/Attachments/DocumentAttachments.ascx" TagName="DocumentAttachments" TagPrefix="uc1" %>

<uc1:DocumentAttachments ID="DocumentAttachments"  runat="server" />


reading the documentation i gather that you need to pass in a Guid on the AttachmentGroupGUID property in the documentation it mentions passiing in the form field name which would be Images. giving me this

<uc1:DocumentAttachments ID="DocumentAttachments" AttachmentGroupGUID="Images"  runat="server" />


This throws an error "Cannot create an object of type 'System.Guid' from its string representation '' for the 'AttachmentGroupGUID' property."

can any one help me out with this?

i had a look in the db and in the property table Images col there is no data!
but in the attachments folder the images are there! is this normal?




User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 4/29/2010 8:32:11 AM
   
RE:attribute type 'document attachment' in doc type
Hello,


we were communicating via e-mail. For other visitors who are interested in:

That web part works for Grouped attachments (Attachments documentation). The field of your document type table will be empty and it will store them in CMS_Attachment table. If you find your records in CMS_Attachment table (AttachmentGroupGUID column) you can see the requested GUID for the web part properties. You can also find the GUID by API. Please note that you need to assign a GUID object not string object.


Best regards,
Helena Grulichova

User avatar
Member
Member
deepanshp-gmail - 1/18/2011 5:59:07 AM
   
RE:attribute type 'document attachment' in doc type
Please tell how to find the Guid By API. ie DocumentAttachment's AttachmentGroupGUID.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/20/2011 2:50:05 AM
   
RE:attribute type 'document attachment' in doc type
Hello,


Below you can find code example which you need to use to get AttachmentGroupGUID of your document type field (The code example is for cms.news document type and field NewsAttachments which is of type “Document attachments”):


using CMS.SettingsProvider;
using CMS.FormEngine;
DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.news");

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


Best regards,
Helena Grulichova