Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm in the process of using the grid datatype with a custom editor and I'm having trouble rendering the data on a template.
I don't believe the custom editor is causing any problem as that seems to be working correctly and storing the data.
I have a feeling it may be because of the way I have my page set up:
Essentially I have a parent page, with nested 'content region' document types beneath it. These 'content regions' have a property that uses the grid data type.
On my page template I'm trying to iterate over all the nested content regions, and render the grid data for each.
So on my page template I have this:
And then within my partial I have the following:
@foreach (var contentRegion in Model.Content.Children.Where(cr => cr.IsVisible()))
<div class="text-content" id="@(contentRegion.Name.ToLower().Replace(" ", ""))">
<!-- Main Heading -->
<!-- Sub Heading -->
<!-- Separator -->
<!-- Separator -->
Hopefully this all makes sense so far and you can see I'm simply trying to render the grid data for each of my nested content regions. However when I try to view the page I receive the following error:
When I edit the 'Bootstrap3.cshtml' view and simply spit out the model, it seems to display the json string with all of the content for the grid editor ie:
So from what I can gather, it seems the json isn't being deserialized properly for the bootstrap3 view to handle the data. It's simply treating it as a string which is why it's throwing the error.
I don't know exactly what I've done wrong here but I have a feeling it's something to do with me having this 'content region' nested children set up. Is anyone able to point me in the right direction here?
I also posted this up on stackoverflow and managed to find a solution. You can find it here just in case anyone else runs into the same problem:
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted