Pass Value from Home page into partial view and render on every page
Hi All,
Fairly new to Umbraco, so be nice - I've looked around and cannot see an answer to my issue
I have a Home Page and a second page, these are both under a Master template
The second page is a child of the Home page.
I have a partial view rendered in the Master view and then rendered on every page
OK so the problem is that on the Partial Page it has some Values that im passing to it from the Home page.
But when I render the second page the values do not come through.
I understand that the content for these values are on the Home page, but they do not render on the second page.
How can I pass the content from the Home Page to the second page and render it without creating the content on every single page.
You could try a recursive lookup on the property value - if you pass true as an optional parameter of GetPropertyValue() you can recurse up the content tree:
content.GetPropertyValue('propertyAlias', true)
Another option would be to move the property off the homepage and onto a config node, which you can then reference from anywhere in the site.
Personally, I like using config nodes - has the added benefit of being able to provide permissions separate from the rest of the site content.
Pass Value from Home page into partial view and render on every page
Hi All,
Fairly new to Umbraco, so be nice - I've looked around and cannot see an answer to my issue
I have a Home Page and a second page, these are both under a Master template
The second page is a child of the Home page.
I have a partial view rendered in the Master view and then rendered on every page
OK so the problem is that on the Partial Page it has some Values that im passing to it from the Home page. But when I render the second page the values do not come through. I understand that the content for these values are on the Home page, but they do not render on the second page.
How can I pass the content from the Home Page to the second page and render it without creating the content on every single page.
The partial views are my header and footers.
Cheers
Hi James
You could try a recursive lookup on the property value - if you pass
true
as an optional parameter ofGetPropertyValue()
you can recurse up the content tree:content.GetPropertyValue('propertyAlias', true)
Another option would be to move the property off the homepage and onto a config node, which you can then reference from anywhere in the site.
Personally, I like using config nodes - has the added benefit of being able to provide permissions separate from the rest of the site content.
Hi Nathan,
Thanks for that, I actually just figured that exact same answer out - took ages.
For images
and then just for normal text.
Awesome - Thanks
is working on a reply...