Hi, as the title goes. I'm trying to get an IEnumerable of
In the first line, I assign the news page to the a variable "news", of IPublishContent.
In the second line, I'm getting the list of posts dangling below that page. (I'm only only a limited number of them, which I specified with "Take(numberOfItemsToDisplay)"
Here I'm getting an error on the second line, saying "news" was null.
Since I clearly specified the alias when instantiating it, I have no idea why it went wrong.
Could you tell us possible reasons if you have any clue...?
Hi Tofu
This error suggests to me that the page you are loading this on, does not have the document type alias of "news" and neither do any of it's ancestors. Ancestors goes back up the tree towards the top node.
Check the alias is correct.
Make sure you are not trying to call this from a page which is nothing to do with the news doc type.
Make sure you are not trying to call this from a page which is nothing to do with the news doc type.
Excuse me for my delayed response.
Thank you for your suggestion. I was calling the page from an irrelevant page as you expected. I changed the master template, and I was able to display the page as intended!
AssignedContentItem.AncestorOrSelf("alias") returns null
Hi, as the title goes. I'm trying to get an IEnumerable of
In the first line, I assign the news page to the a variable "news", of IPublishContent. In the second line, I'm getting the list of posts dangling below that page. (I'm only only a limited number of them, which I specified with "Take(numberOfItemsToDisplay)"
Here I'm getting an error on the second line, saying "news" was null.
Since I clearly specified the alias when instantiating it, I have no idea why it went wrong.
Could you tell us possible reasons if you have any clue...?
Waiting for your comments!
Hi Tofu This error suggests to me that the page you are loading this on, does not have the document type alias of "news" and neither do any of it's ancestors. Ancestors goes back up the tree towards the top node.
Check the alias is correct.
Make sure you are not trying to call this from a page which is nothing to do with the news doc type.
Kind regards
Paul
Excuse me for my delayed response. Thank you for your suggestion. I was calling the page from an irrelevant page as you expected. I changed the master template, and I was able to display the page as intended!
Kind Regards, tofu
is working on a reply...