I have Umbraco Content List containing multiple Umbraco Content pages. When I try to find some content page properties like Page Title or Heading or bodyText I'm getting "The function evaluation requires all threads to run.
". Here is my code.
@using Umbraco.Web
@using Umbraco.Web.Mvc
@{
Layout = "T";
}
@{
var UContentList = Model.Content.Children;
var SContentList = new List<MyProgram.Models.MyContent>();
foreach (var uContent in UContentList)
{
var SContent = new IMyProgram.Models.MyContent(
uContent.pageTitle.ToString(),
uContent.contentExcerpt.ToString()
);
SContentList.Add(SContent);
}
Please help how do I get the values from these properties
I've managed to do it. First need to debug and do this: https://blogs.msdn.microsoft.com/eliofek/2012/12/12/why-do-we-get-the-function-evaluation-requires-all-threads-to-run/
Then here is the source:
@inherits UmbracoTemplatePage
@using Umbraco.Web
@using Umbraco.Web.Mvc
@using ContentModels = Umbraco.Web.PublishedContentModels;
@{
/**/
Layout = "";
}
@{
var UContentList = Model.Content.Children();
var SContentList = new List<MyProgram.Models.MyContent>();
foreach (var uContent in UContentList)
{
var SContent = new MyProgram.Models.MyContent(
uContent.GetPropertyValue("pageTitle").ToString(),
uContent.GetPropertyValue("contentExcerpt").ToString(),
uContent.Url.ToString()
);
SContentList.Add(SContent);
}
The difference is the @inherits and @using ContentModels.