I am not sure you can do this directly in the grid* The model that is passed to a grid view is actual that of the grid markup (so the json for the grid not the content page).
Also if you put the code in the grid then it will execute no matter what content someone puts in your grid, this may be what you want, but it would be better to have a separate partial to go get the child content, and render it out.
I suspect what you want is closer to what is inside the current starter kit for umbraco where - the a list of blog pages is written out inside a grid block. this is achieved via a macro, that is then inserted (by the editor) inside the grid code.
the actual code to display the children/blog is within the Macro code, and not the grid - when the grid template encounters the macro it calls that code, this allows it to be separate and not change the grid rendering.
the best way to see this might be to quickly install a new version of umbraco and do a default install - you can then see this in the starter kit.
*You might be able to 'do' this within the grid using Umbraco.AssignedContentItem to get the current Content object for the page, but i don't thing that's right (and it may not actually be accurate)
How use CurrentPage.Children in Currentpage.getgridhtml
I have question how to insert CurrentPage.Children in Currentpage.getgridhtml. i see example about blog content and i get the template like this:
and i create custom template name is "category" just page content not like blog, like this :
my trouble is how to use :
from blog inside
@CurrentPage.GetGridHtml("content", "category")
file in => "partial views->grid->category"i try to add blog code for get child page introduction inside :
but i can't get the ouput.
Hi
I am not sure you can do this directly in the grid* The model that is passed to a grid view is actual that of the grid markup (so the json for the grid not the content page).
Also if you put the code in the grid then it will execute no matter what content someone puts in your grid, this may be what you want, but it would be better to have a separate partial to go get the child content, and render it out.
I suspect what you want is closer to what is inside the current starter kit for umbraco where - the a list of blog pages is written out inside a grid block. this is achieved via a macro, that is then inserted (by the editor) inside the grid code.
the actual code to display the children/blog is within the Macro code, and not the grid - when the grid template encounters the macro it calls that code, this allows it to be separate and not change the grid rendering.
the best way to see this might be to quickly install a new version of umbraco and do a default install - you can then see this in the starter kit.
but the source code is here : https://github.com/umbraco/The-Starter-Kit with the maco code being here: https://github.com/umbraco/The-Starter-Kit/blob/master/src/Umbraco.SampleSite.Website/Views/MacroPartials/LatestBlogposts.cshtml
*You might be able to 'do' this within the grid using Umbraco.AssignedContentItem to get the current Content object for the page, but i don't thing that's right (and it may not actually be accurate)
is working on a reply...