Select Single Node is null

giang le asked on April 22, 2014 22:35

Hi all! I tried retrieve tree node of current page using SelectSingleNode but i got a error "Object reference not set to an instance of an object".I tried hard code a node Id of other page and it is not null.

var tr = new TreeProvider();
TreeNode tn = tr.SelectSingleNode(CMSContext.CurrentDocument.DocumentID);

Please help me!

Thank!

Correct Answer

Yehuda Lando answered on April 23, 2014 00:05

You need to use CMSContext.CurrentDocument.NodeID

0 votesVote for this answer Unmark Correct answer

Recent Answers


giang le answered on April 23, 2014 05:33

thank you! I changed DocumentID by NodeID and it work correct!

GiangLt3

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.