I have an umbraco 8 site with a document type that has a nested content in it. That nested content has an element composed of a color picker (backgroundColor) and a grid layout (gridLayout).
When rendering the nested content I can't render the grid as the helper I'm used to
Html.GetGridHtml(item, "grid")
does not work with IPublishedElement (json result of grid layout)
Here's my code:
var layouts = Model.Value<IEnumerable<IPublishedElement>>("layouts");
foreach(var layoutItem in layouts)
{
<div style="background-color: #@layoutItem.Value("BackgroundColor")">
@Html.GetGridHtml(layoutItem, "gridLayout", "custom/customgridlayout")
</div>
}
The error is at Html.GetGridHtml
"cannot convert from 'Umbraco.Core.Models.PublishedContent.IPublishedElement' to 'Umbraco.Core.Models.PublishedContent.IPublishedContent'"
I check and the result grid layout, as it appears in nested content, is json...
I can get BackgroundColor, at least as a string...
I'm sure I'm making a huge mess with this but how can I render such a grid?
Render grid in nested content
Hi, pretty newbie here
I have an umbraco 8 site with a document type that has a nested content in it. That nested content has an element composed of a color picker (backgroundColor) and a grid layout (gridLayout).
When rendering the nested content I can't render the grid as the helper I'm used to
does not work with IPublishedElement (json result of grid layout)
Here's my code:
The error is at Html.GetGridHtml "cannot convert from 'Umbraco.Core.Models.PublishedContent.IPublishedElement' to 'Umbraco.Core.Models.PublishedContent.IPublishedContent'"
I check and the result grid layout, as it appears in nested content, is json... I can get BackgroundColor, at least as a string...
I'm sure I'm making a huge mess with this but how can I render such a grid?
Best regards
Jorge
I found a way!
Instead of calling Html.GetGridHtml helper I rendered it using grid partial view
I use a custom grid layout copied from one already existing bootstrap3.cshtml.
Jorge
is working on a reply...