As per the official documentation (https://our.umbraco.com/documentation/getting-started/backoffice/property-editors/built-in-property-editors/grid-layout/render-grid-in-template) the following should work
All I've done is install umbraco with the demo site included it has a blog page and I've just tried to change the grid renderer from the default to Foundation by add the renderer from here
Sorry just looked at your screen shots again, your bodyText is defined on the blog Post documentType and it looks like you are trying to render it out on the master template.
Try moving your original code to the blogpost template. (using Model)
Failing that i will load up a new instance of V8 and install the starter kit to have a look for you.
Apologies, im trying to help from my phone on the train.
Moved @Html.GetGridHtml(Model,"bodyText","Foundation5") from Master into the Blogpost template.
Got rid of the error BUT now the blogpost renders twice on the page: firstly with Foundation markup, then again with Bootstrap markup.
I'm also why I have to include this on the blogpost template since blogpost is rendered within the master layout? This makes a bit of a nonsense of using master pages.
Something to try; are you using @RenderBody() in the master template?
<body>
@RenderBody()
</body>
That will output the blog post content with the master page wrapper, also make sure that there is no reference to the @Html.GetGridHtml(Model,"bodyText","Foundation5") in the master template.
As for the doubling of content: make sure your renderer does not have any of the bootstrap renderer markup in.
If you could share your master and blog template I might be able to help further!
Render grid in template not working
Hi
I want my content grids to render Foundation rather than Bootstrap markup.
I've included a Foundation5 grid renderer in /views/partials/grid/
My understanding is that this will use Foundation CSS markup when editor's add content grids. Is this correct?
I've added @Html.GetGridHtml(Model,"propertyAlias","Foundation5") to my master template but it's not valid and I get:
Exception Details: System.NullReferenceException: No property type found with alias propertyAlias
What is the propertyAlias for the content grid? I've tried bodyText, content, contentGrid etc
Hi Bikeman,
As per the official documentation (https://our.umbraco.com/documentation/getting-started/backoffice/property-editors/built-in-property-editors/grid-layout/render-grid-in-template) the following should work
@Html.GetGridHtml(Model, "propertyAlias", "bootstrap2")
The property alias is defined by you when you add the grid to your document type. In my example here my alias is 'gridContent'
So my call in my view would be
Hope that helps.
Thanks Paul
Hi
Thanks for the reply. I have a new install with the demo site and I can see that the item you refer to in my case is 'bodyText' but it's not working.
I've included @Html.GetGridHtml(Model,"bodyText","Foundation5") in my master
Hi Bikeman,
Are you using Models builder, if yes, which mode are you using and have you generated your models ?
Are you able to share your code? i might help to understand the issue more.
You might need to pass in Model.Content as thats the IPublishedContent
Have a read through this post https://our.umbraco.com/forum/umbraco-8/95845-render-grid-in-umbraco-8. It might be similar
thanks
Paul
Sorry I don't understand what you're asking.
All I've done is install umbraco with the demo site included it has a blog page and I've just tried to change the grid renderer from the default to Foundation by add the renderer from here
https://our.umbraco.com/packages/developer-tools/umbraco-grid-renderers/
and following the instructions from here
https://our.umbraco.com/documentation/getting-started/backoffice/property-editors/built-in-property-editors/grid-layout/render-grid-in-template
I can't see anything in that post that helps. Here's my template
Hi,
Sorry, I'm just travelling on the train. Did you try passing in Model.Content instead of just model?
Your error is suggesting that bodyText doesn't exist on the Model you are passing in
Paul
I tried that (though the post you gave me does say in umbraco 8 the RenderModel has been simplified from Model.content to Model).
It results in Compiler Error Message: CS1061: 'IPublishedContent' does not contain a definition for 'content'
Hi,
Sorry just looked at your screen shots again, your bodyText is defined on the blog Post documentType and it looks like you are trying to render it out on the master template.
Try moving your original code to the blogpost template. (using Model)
Failing that i will load up a new instance of V8 and install the starter kit to have a look for you.
Apologies, im trying to help from my phone on the train.
thanks Paul
Partial progress.
Moved @Html.GetGridHtml(Model,"bodyText","Foundation5") from Master into the Blogpost template.
Got rid of the error BUT now the blogpost renders twice on the page: firstly with Foundation markup, then again with Bootstrap markup.
I'm also why I have to include this on the blogpost template since blogpost is rendered within the master layout? This makes a bit of a nonsense of using master pages.
Hi bikeman,
Something to try; are you using @RenderBody() in the master template?
That will output the blog post content with the master page wrapper, also make sure that there is no reference to the @Html.GetGridHtml(Model,"bodyText","Foundation5") in the master template.
As for the doubling of content: make sure your renderer does not have any of the bootstrap renderer markup in.
If you could share your master and blog template I might be able to help further!
Take care, Rob
is working on a reply...