Umbraco 8 | How to display a Grid within Nested Content
Hi Peeps,
I have been having trouble displaying a Grid View inside nested content with Umbraco 8.
I have done this 100ds of times with Umbraco 7 and never had any problems.
In the backend there is no problem. I can add a Grid View to the nested content section an it seems to populate as expected.
The trouble is when it comes to render i the frontend.
So the usual code
@Html.GetGridHtml("WHAT GOES HERE", "mainText", "bootstrap3-fluid")
With Umbraco 7 I used to just pass the nested content section model which is IPublishedContent and it just works.
The problem with Umbraco 8 is that the Grid is wanting an IPublishedContent and the nested content section model with Umbraco 8 is now IPublishedElement.
Is their to get the Grid to either accept IPublishedElement or is there anyway to cast IPublishedElement into IPublishedContent?
Umbraco 8 | How to display a Grid within Nested Content
Hi Peeps,
I have been having trouble displaying a Grid View inside nested content with Umbraco 8.
I have done this 100ds of times with Umbraco 7 and never had any problems.
In the backend there is no problem. I can add a Grid View to the nested content section an it seems to populate as expected.
The trouble is when it comes to render i the frontend.
So the usual code @Html.GetGridHtml("WHAT GOES HERE", "mainText", "bootstrap3-fluid")
With Umbraco 7 I used to just pass the nested content section model which is IPublishedContent and it just works.
The problem with Umbraco 8 is that the Grid is wanting an IPublishedContent and the nested content section model with Umbraco 8 is now IPublishedElement.
Is their to get the Grid to either accept IPublishedElement or is there anyway to cast IPublishedElement into IPublishedContent?
Thanks in advanced
David
Hi Guys,
So I figured this out. You can actually pass in IPublishedProperty instead of content.
I couldn't see this for looking.
Anyway if anyone has the same problem then the way I achieved this was.
@Html.GetGridHtml(nestedContent.GetProperty("mainText"),"bootstrap3-fluid")
Regards David
Thank you for this! It helped a ton
Glad I could help.
Regards David
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.