Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello,
I need to display nodes from parents at second level in umbraco 7.6.
Can someone please help.
Regards,
kusum
Hi kusum,
Would it be possible for you to share a screenshot of you content tree of the pages that you want to display?
And also let us know on which page you want the data to be outputted.
Best,
/Dennis
Hello Denis,
Config EN Page one sub page 1 Sub 1.1 Sub 1.2 sub page 2 Sub 2.1 Sub 2.2
When I am in page sub page 1, the menu should have the values sub page 1 and sub page 2.
The menu should be same when I am in the page sub 1.1. that is menu should have the values sub page 1 and sub page 2.
Please let me know if I am not clear.
Thanks,
Hi Kusum
The best way to do this is to find the parent you are interested in by document type alias.
Home page
IPublishedContent homePage = Model.Content.AncestorOrSelf("Home");
Blog list page
IPublishedContent blog = Model.Content.AncestorOrSelf("Blog");
See this link for more details. http://www.codeshare.co.uk/blog/how-to-find-the-home-page-in-umbraco/
Cheers
Paul
Hello Paul,
But what if the parent is not the same everytime ?
Then you can use:
Model.Content.AncestorOrSelf(2);
Just change the number accordingly for the correct level.
Tried and getting error :
Compiler Error Message: CS1579: foreach statement cannot operate on variables of type 'Umbraco.Core.Models.IPublishedContent' because 'Umbraco.Core.Models.IPublishedContent' does not contain a public definition for 'GetEnumerator'
What is at the top of your view?
Have you got?
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
Try putting this somewhere in the view to render out the name.
@Model.Content.AncestorOrSelf(2).Name
In a partial view you do it like this:
@inherits UmbracoViewPage @Umbraco.AssignedContentItem.AncestorOrSelf(2).Name
working. Thanks :)
Great, please click on 'mark as solution' for the one which helped you get it working.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Display nodes from parent at second level
Hello,
I need to display nodes from parents at second level in umbraco 7.6.
Can someone please help.
Regards,
kusum
Hi kusum,
Would it be possible for you to share a screenshot of you content tree of the pages that you want to display?
And also let us know on which page you want the data to be outputted.
Best,
/Dennis
Hello Denis,
When I am in page sub page 1, the menu should have the values sub page 1 and sub page 2.
The menu should be same when I am in the page sub 1.1. that is menu should have the values sub page 1 and sub page 2.
Please let me know if I am not clear.
Thanks,
kusum
Hi Kusum
The best way to do this is to find the parent you are interested in by document type alias.
Home page
Blog list page
See this link for more details. http://www.codeshare.co.uk/blog/how-to-find-the-home-page-in-umbraco/
Cheers
Paul
Hello Paul,
But what if the parent is not the same everytime ?
Regards,
kusum
Then you can use:
Just change the number accordingly for the correct level.
Tried and getting error :
What is at the top of your view?
Have you got?
Try putting this somewhere in the view to render out the name.
In a partial view you do it like this:
working. Thanks :)
Great, please click on 'mark as solution' for the one which helped you get it working.
is working on a reply...