Tuesday, 3 June 2014

Kentico 7 - Get Specific document information

Leave a Comment
This post will show how to get specific document information using Transformation In Kentico 7.

Note : i have tested this method in kentico 7 only, donno if the other version will work.

You can refer this link to create new transformation method

Example :

You can use this method in your transformation let say you create new repeater and want to show the parent name of the binding document type data. In this scenario, the document type store under different parent node.

       public string getDocumentInfo(string documentID, string parentProperties)
        {
            TreeProvider tree = new CMS.DocumentEngine.TreeProvider(CMSContext.CurrentUser);
            TreeNode Node = DocumentHelper.GetDocument(Convert.ToInt16(documentID), tree);

            if (Node != null)
            {
                switch (parentProperties)
                {
                    case "NodeID": return Node.NodeID.ToString();
                    case "NodeAliasPath": return Node.NodeAliasPath;
                    case "NodeName": return Node.NodeName;
                    case "NodeAlias": return Node.NodeAlias;
                    case "NodeClassName": return Node.NodeClassName;
                    case "NodeParentID": return Node.NodeParentID.ToString();
                    case "NodeLevel": return Node.NodeLevel.ToString();
                    default: return string.Empty;
                }
            }
            else
            {
                return "Current UserInfo :" + CMSContext.CurrentUser + " Node is null";
            }
        }


How to use

getDocumentInfo(Eval("NodeParentID").ToString(),"NodeName")


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.