I need some help figuring out how list views work.
Let me begin with this:
This is the Personnel content. I've added one list item to it, a Person.
I take this to mean my document types for Personnel and Person are working, and the Personnel document type successfully incorporates a list view, and the Person document type is successfully added as a child node.
However, when I run my site and go to the Personnel page, I don't see anything for the Person I created.
My template for Person looks like this:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "Master.cshtml";
Umbraco.Web.PublishedContentModels.Person person = (Umbraco.Web.PublishedContentModels.Person)Model.Content;
}
<p>Nothing to see, but we could make a lesson to display a person</p>
Nothing's being pulled from the Person content but I would think I would at least see "Nothing to see, but we could make a lesson to display a person". Instead I get a blank page (with the title "Personnel" at the top so I know I'm at the Personnel page).
What else is needed to show something from the list of Persons on the Personnel page?
Hey, you could try something like this and see if anything appears on the page.
@inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.Personnel>
@using ContentModels = Umbraco.Web.PublishedModels;
@{
Layout = "Master.cshtml";
}
<p>Nothing to see, but we could make a lesson to display a person</p>
foreach (var item in Model.Children("Person"))
{
item.Value("Name")//or any other property which you have in "person" doctype
}
How do list views works?
Hello,
I need some help figuring out how list views work.
Let me begin with this:
This is the Personnel content. I've added one list item to it, a Person.
I take this to mean my document types for Personnel and Person are working, and the Personnel document type successfully incorporates a list view, and the Person document type is successfully added as a child node.
However, when I run my site and go to the Personnel page, I don't see anything for the Person I created.
My template for Person looks like this:
Nothing's being pulled from the Person content but I would think I would at least see "Nothing to see, but we could make a lesson to display a person". Instead I get a blank page (with the title "Personnel" at the top so I know I'm at the Personnel page).
What else is needed to show something from the list of Persons on the Personnel page?
Do you want to list all child items? If so you could use Model.Content.Children()
Hey, you could try something like this and see if anything appears on the page.
Thanks both,
I managed to get some content showing by doing this:
is working on a reply...