ASPX templates
Version 4.x > ASPX templates > Problem getting related docs View modes: 
User avatar
Certified Developer 9
Certified Developer 9
jkh80 - 7/10/2009 12:03:48 PM
   
Problem getting related docs
I am trying to list the related docs for a document but I'm not having any luck, and I'm not sure if what I am doing is wrong or I am misunderstanding how the related docs feature works.

I have a document set up that has two documents related to it. The document is on the left side, and the two documents related to it are on the right side. The name of the relationship is "is related to" which seems to be the only option.

I have looked at the relateddocuments web part and tried using it, but it did not work. I now am using the CMS.TreeHelper.GetDocuments() call from the web part directly in my template, and that is not returning any data. Here is what I am using currently:


DataSet ds = TreeHelper.GetDocuments(
CMSContext.CurrentSiteName, // siteName
"/%", // aliasPath
CMSContext.CurrentDocument.DocumentCulture, // cultureCode
true, // combineWithDefaultCulture
"", // classNames
"", // where
"", // orderBy
-1, // maxRelativeLevel
true, // selectOnlyPublished
CMSContext.CurrentDocument.NodeGUID, // relationshipWithNodeGuid
"", // relationshipName
false, // relatedNodeIsOnTheLeftSide
-1); // topN


I have tried using different values for some of the parameters, and specifying class names, but nothing has worked for me.

If I simply want to list all of the related documents for the CMSContext.CurrentDocument node, what am I doing wrong?

Thanks in advance.

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 7/11/2009 2:57:35 PM
   
RE:Problem getting related docs
Hello,

could you please specify the code name of relationship into appropriate parameter, i.e.:
"isrelatedto", // relationshipName

and also change 'relatedNodeIsOnTheLeftSide' parameter to true? (there is node with specified GUID, i.e. in your case the current document, considered to be related node as it is related to documents that will be returned by GetDocuments method).

Best Regards,

Martin Dobsicek

User avatar
Certified Developer 9
Certified Developer 9
jkh80 - 7/13/2009 2:56:31 PM
   
RE:Problem getting related docs
Hi Martin,

Ah, yes, I used "isrelatedto" where previously I had tried "is related to" and I'm getting the data back now.

Thank you!