Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Document type question View modes: 
User avatar
Member
Member
gary.chan-e-crusade - 4/6/2009 2:50:34 AM
   
Document type question
Hi,

I would like to customize a document type contain text and image. In its transformation, it have text and image to display.
For example,the attribute name of image is PromotionBanner, How can i display the image in its transformation.
Here is code i attempt:

<img alt="testing" src=<%# GetFileUrl("PromotionBanner")%> />


Thanks

User avatar
Member
Member
zhaojicheng-artmtech - 4/6/2009 3:09:02 AM
   
RE:Document type question
you can try
<%# IfEmpty(Eval("PromotionBanner"), "", GetImage("PromotionBanner")) %>

User avatar
Member
Member
zhaojicheng-artmtech - 4/6/2009 3:18:21 AM
   
RE:Document type question
both of the same

User avatar
Member
Member
zhaojicheng-artmtech - 4/6/2009 3:28:12 AM
   
RE:Document type question
if you want to get the actual files path see the below
http://devnet.kentico.com/Knowledge-Base/API-and-Internals/How-to-retrieve-an-image-from-the-KenticoCMS-datab.aspx

User avatar
Member
Member
zhaojicheng-artmtech - 4/6/2009 7:43:01 AM
   
RE:Document type question
zhaojicheng-artmtech wrote: if you want to get the actual files path see the belowthat is wrong.sorry for my mistake.
http://devnet.kentico.com/Knowledge-Base/API-and-Internals/How-to-retrieve-an-image-from-the-KenticoCMS-datab.aspx


User avatar
Member
Member
gary.chan-e-crusade - 4/6/2009 8:53:47 PM
   
RE:Document type question
that's ok,
but would you mind sharing any possible suggestions to work on?

User avatar
Member
Member
gary.chan-e-crusade - 4/6/2009 8:17:06 AM
   
RE:Document type question
Thanks for suggestion,
But there is error occur after i add the code in the transformation like :
<%#
Guid attachmentGuid = ValidationHelper.GetGuid(treeNode.GetValue(PromotionBanner), Guid.Empty);
string nodeAlias = ValidationHelper.GetString(treeNode.GetValue("NodeAlias"), "");
string fileUrl = ResolveUrl(AttachmentManager.GetAttachmentUrl(attachmentGuid, nodeAlias));
%>

Error:

[CMSDataProperties.LoadTransformation]: http://server//CMSTransformations/2795f767-e4f1-4435-a60b-34a8f84a3240/custom/promotion/default.ascx(16): error CS1026: ) expected


User avatar
Member
Member
zhaojicheng-artmtech - 4/7/2009 7:03:53 AM
   
RE:Document type question
What are you up for? can you please be more specific

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 4/15/2009 7:32:21 AM
   
RE:Document type question
Hello,

could you please let me know what field type you have set for the image field (UploadFile or ImageSelection)?

Best Regards,

Martin Dobsice.

User avatar
Member
Member
Jagr - 4/16/2009 8:48:56 AM
   
RE:Document type question
Hi,

I have slightly different problem regarding document types so I didn't want to open a new thread.

Is it possible to have to file (attachment) fields in custom document type?

I am trying to attach two different files to my document type, and I am doing it from my custom user control. Also, I followed the instructions from guide regarding attachments addition and everything seems OK.

Guids are created, but when I want to use "getattachment" from my code, I get error that the file doesn't exist. This only happens if I upload both desired files. If I upload only one of them, the file is visible and can be downloaded.