ASPX templates
Version 4.x > ASPX templates > CMS Document View Webpart View modes: 
User avatar
Member
Member
mickey-invision - 12/10/2009 6:24:23 PM
   
CMS Document View Webpart
I'm trying to use the Universal Document Viewer webpart in a template, and it doesn't work.

The page has the control definition:

<%@ Register src="~/CMSWebParts/Viewers/cmsdocumentviewer.ascx" tagname="DocumentViewer" tagprefix="uc2" %>

And then I am calling it as such:

<uc2:DocumentViewer ID="taxonomyViewer" runat="server" ClassNames="CUSTOM.Taxonomy" />

where CUSTOM.Taxonomy is the class name of my document.

Then in the codebehind of the document, I'm setting the path:

taxonomyViewer.Path = CMS.CMSHelper.CMSContext.CurrentPageInfo.NodeAliasPath;
taxonomyViewer.TransformationName = "CUSTOM.Taxonomy.Preview";

Nothing shows - however, if I hardcode the path in the control on the aspx page as such, it works..

<uc2:DocumentViewer ID="taxonomyViewer" runat="server" ClassNames="CUSTOM.Taxonomy" Path="/Taxonomy/Hats/Baseball" TransformationName = "CUSTOM.Taxonomy.Preview" />

Why is this so?

I have to mention that integrating my own asp.net code into kentico is extremely frustruating because there is almost no documentation on how to use any of the code that comes along with the webproject.... its all by trial and error... and guessing...


User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 12/11/2009 8:29:13 AM
   
RE:CMS Document View Webpart
Hello,

I would recommend you to add the control properties directly to control – then you need not to care about page life cycle (you may try to place the code to OnPreRender event of page in other case). If you need the current path you may use the dot – e.g. “./%”.
More information about paths: http://devnet.kentico.com/docs/devguide/appendix_b___path_expressions.htm

Other helpful documentation:
The API Reference is here: http://devnet.kentico.com/downloads/kenticocms_api.zip
The Controls documentation is here: http://devnet.kentico.com/docs/controls/index.html
The Web parts documentation: http://devnet.kentico.com/docs/webparts/Kentico_CMS_WebParts.htm

I hope it will help you.

Best regards,
Helena Grulichova