Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

Use Custom Field with TreeNode

$
0
0
The Modal code with the query using the multidocumentquery public List@TreeNode@ GeneralList { get; set; } // General GeneralList = new MultiDocumentQuery() .Type(@Site.Article@, q =@ q .Columns(@ArticleID@, @ArticleTitle@, @Image@) .Path(@%/Articles/%@, PathTypeEnum.Explicit) .Path(@%/Posts/%@, PathTypeEnum.Explicit) ) .Type(@Site.MarketingPage@, q =@ q .Columns(@MarketingPageID@, @Title@, @Hero@) .Path(@%/Showcase-Pages/%@, PathTypeEnum.Explicit) ) .Where(@DocumentID IN (SELECT[DocumentID] FROM CMS_DocumentCategory WHERE[CategoryID] = 46 GROUP BY DocumentID HAVING COUNT('DocumentID') = 1)@) .Published() .Columns(@ArticleTitle@, @Title@, @Hero@, @Image@, @ArticleID@, @MarketingPageID@, @DocumentID@, @NodeName@, @NodeAliasPath@, @DocumentPublishFrom@, @NodeAlias@, @ClassName@) .WithCoupledColumns() .OnSite(SiteContext.CurrentSiteName) .OrderBy(@NewID()@) .ToList(); The query turns out fine, grabbing all the info needed but when I go into the view: @foreach (var page in Model.GeneralList) { @div class=@sponsored-article container@@ @a href=@@page.AbsoluteURL@@ @img src=@@ width=@435px@ height=@245px@ /@ @h3@@page.NodeName@/h3@ @/a@ @/div@ } NodeName pulls in fine but if I use @page.ArticleTitle to try and get the article title from the Article column, I get the error: CS1061: 'TreeNode' does not contain a definition for 'ArticleTitle' and no accessible extension method 'ArticleTitle' accepting a first argument of type 'TreeNode' could be found (are you missing a using directive or an assembly reference?)Any thoughts on how to implement it so these custom fields will pull in like the default ones?Thanks for any help.

Viewing all articles
Browse latest Browse all 8901

Trending Articles