I'm trying to import some html into a grid layout programmatically.
The grid just needs to be 1 column, 1 row, with a rich text editor to hold the html.
I've tried rendering an existing grid in JSON, to get the structure, replace the html, and then use SetValue on IContent, but the resulting grid is empty in the back office.
The same question is on Stackoverflow, but there's no answer.
Populate grid layout with IContent.SetValue
Hi all,
I'm trying to import some html into a grid layout programmatically. The grid just needs to be 1 column, 1 row, with a rich text editor to hold the html.
I've tried rendering an existing grid in JSON, to get the structure, replace the html, and then use SetValue on IContent, but the resulting grid is empty in the back office.
The same question is on Stackoverflow, but there's no answer.
How would you import content into Umbraco page Grid Layout using ContentService?
Has anyone successfully done this, or have any idea where i'm going wrong?
Thanks in advance for any help!
Dan
It turned out my issue was that I had quotes in the html that needed escaping, so it was breaking the JSON.
SetValue with the JSON below worked for me.
Hi Dan Patching,
Thanks for the above snippet.
I want one clarification from that. I am thinking that the variable string gridContent is Property Group. please clarify me If I was wrong.
Thanks in Advance,
Gopi B.
is working on a reply...