4

I am working on a page (with Component Temaplte) where Dynamic components are loaded using ComponentPresentationAssembler. It is working fine until I added Asp.net User control in Template Building Block (DWT file). Now when page loaded, asp.net user control has been published as html in page instead of actual data. I am very new to Tridion and hardly done any dynamic work till now.

Please find the code bellow which was used to load content:

ComponentPresentationAssembler cpa = new ComponentPresentationAssembler();
            string content = cpa.GetContent(itemInformation.ComponentUri, ComponentTemplateURI);

Component Template which uses above TBB has following parameters:

  • Output format: REL
  • Priority: Never Link
  • Component Presentation based on this component template will be: Published as a Dynamic Component. With checkbox checked Allow on page using Dynamic assembly.

Just to confirm when page loaded user control was loaded as html in page for example:

Am I missing anything?

Also on Component Template I have following elements:

  • DLL ExtractSystemConfigurationEntry
  • DLL Add All Liniked Components to Package
  • DWT file Default Finish Action
  • DLL Image resizer
  • DLL SystemTranslationRewrite
  • DLL SystemConfigurationRewrite
  • DLL Resolve Article References
  • DLL Push Keyword information

Any help will be highly appreciated.

Many thanks,

Vip

1 Answer 1

2

The easiest way to achieve what you want is to not use a Dynamic Template, and just let the output of the Component Presentation be rendered as part of the page. I assume that your pages are published to the file system with an extension that IIS will execute (like .aspx) and if this is the case, then your code will be included in the body of that file and will execute on retrieval.

If you really want it to be a Dynamic Component Presentation loaded at runtime, then you can change the Component Template Output Format to "ASCX Control". Unfortunately, this will require configuration on Content Delivery, particularly the cd_storage_conf.xml for both the deployer and the web application server must be configured to contain the storage location of .ascx component presentations.

What Tridion does when you change the CT output format to ASCX Control is that it will store the DCP in the File System (in the location specified in cd_storage_conf.xml) and it will then let IIS execute the code before adding it to the page. This means that the result of your API call (cpa.GetContent) will contain the DCP after it's been executed by IIS.

Last work about REL: REL DCPs are (usually) stored in the database and are executed by Tridion when retrieving them. To have any custom dynamic code in REL DCPs you need to create a REL tag handler (in Java).

Useful documentation links (login required):

3
  • changed output format to ascx, and when loaded page got following error: CPAssembler error: WAIPage object not initialized. Make sure to use the ComponentPresentationAssembler constructor that accepts a WAIPage I have added following settings in cd_storage_conf.xml file <Item typeMapping="ComponentPresentation" itemExtension=".ascx" storageId="defaultDataFile"/>
    – vip
    Nov 5, 2013 at 14:44
  • See example here: stackoverflow.com/a/10534123/866454 and I don't think using "defaultDataFile" will work. ascx component presentations need to be "inside" the website root.
    – Nuno Linhares
    Nov 5, 2013 at 14:50
  • BTW, you can also use the <tridion:ComponentPresentation> control instead of ComponentPresentationAssembler
    – Nuno Linhares
    Nov 5, 2013 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.