I have created a Grid inside my Document type, but I am having a hard time rendering it inside a ViewComponent. I am pretty sure I am missing something simple here. Here is my current layout
My ViewModel
public class GridViewModel
{
public Newtonsoft.Json.Linq.JToken Grid{ get; set; }
}
Here is my View Component .cs file
public async Task<IViewComponentResult> InvokeAsync()
{
var gridViewModel= new GridViewModel();
var content = context.Content.GetById(1061);
if (_context.TryGetUmbracoContext(out IUmbracoContext context))
{
var grid = content.Value<Newtonsoft.Json.Linq.JToken>("Grid");
gridViewModel.Grid = grid;
}
return View(gridViewModel);
}
Umbraco 10 Render Grid in ViewComponent
Hello,
I have created a Grid inside my Document type, but I am having a hard time rendering it inside a ViewComponent. I am pretty sure I am missing something simple here. Here is my current layout
My ViewModel
Here is my View Component .cs file
And finally my View
If i spit out the Model Grid property I get the Grid Json I'm just not sure how to render it inside a ViewModel
Hopefully someone can help
Thanks
is working on a reply...