I have created a DocType 'Branch' that will be used as a standard branch page multiple times on a site, each branch page will have child pages of a specific DocType i.e. News, Event, Staff Profile.
How would you allow the general branch page to render it child pages by DocType ?
Thanks for your reply, using your code would only render GeneralInformation DocType if they were child pages of the branch page.
I have two branch pages of the same DocType using the same template.
One branch page has child pages of one specific DocType (news )and the other branch page as another specific DocType (event).
I would like each branch page to render only each other child pages
I created a 'Composable Page' Document Type with children of several types of Document Types (via persmissions in Document Type editor).
Regardless of the Document Type of the child(eren) of your Branch page, you can:
foreach (var child in Model.Content.Children())
{
@MvcHtmlString.Create(library.RenderTemplate(child.Id))
}
I realize this is against recommendations (i.e. using the RenderTemplate function, as per RenderTemplate warning) and perhaps should be solved by rendering the partial view directly?
I hope this steers you in the right direction anyway!
You could introduce a property on your Branch node to specify the type of children. This value you could use to filter the type of items you want to render.
Now, about to use RenderTemplate or not, consider the usage of:
@foreach(var child in Model.Content.Children())
{
@Html.Partial("MyPartialName", child)
}
Render DocTypes on a general branch page
Hi Umbraco Team
I have created a DocType 'Branch' that will be used as a standard branch page multiple times on a site, each branch page will have child pages of a specific DocType i.e. News, Event, Staff Profile.
How would you allow the general branch page to render it child pages by DocType ?
thanks Dibs
Hi Dibs
Did you mean to render it via Razor? Something like that:
Hi Alex
Thanks for your reply, using your code would only render GeneralInformation DocType if they were child pages of the branch page.
I have two branch pages of the same DocType using the same template. One branch page has child pages of one specific DocType (news )and the other branch page as another specific DocType (event).
I would like each branch page to render only each other child pages
Thanks Dibs
Hi Dibs,
I created a 'Composable Page' Document Type with children of several types of Document Types (via persmissions in Document Type editor).
Regardless of the Document Type of the child(eren) of your Branch page, you can:
I realize this is against recommendations (i.e. using the RenderTemplate function, as per RenderTemplate warning) and perhaps should be solved by rendering the partial view directly?
I hope this steers you in the right direction anyway!
Regards,
Sijmen
Additional:
You could introduce a property on your Branch node to specify the type of children. This value you could use to filter the type of items you want to render.
Now, about to use RenderTemplate or not, consider the usage of:
HTH
is working on a reply...