Is it possible to render out a grid in a controller?
I tried creating a new RenderModel, but GetGridHtml is nowhere to be found..
Looking for something like this:
var node = Umbraco.TypedContent(nodeId);
var model = new Umbraco.Web.Models.RenderModel(node, System.Globalization.CultureInfo.CurrentUICulture);
var gridOutput = model.Content.GetGridHtml("gridAlias", "gridRenderer");
I know I can just render out a view that calls the method, but that is not what I need, and i'd like to avoid having to make duplicate views.
Basically I want to call a method in my controller that'll return a rendered grid.
GetGridHtml in Controller
Hi,
Is it possible to render out a grid in a controller?
I tried creating a new RenderModel, but GetGridHtml is nowhere to be found..
Looking for something like this:
I know I can just render out a view that calls the method, but that is not what I need, and i'd like to avoid having to make duplicate views.
Basically I want to call a method in my controller that'll return a rendered grid.
Thanks in advance :)
Just tried using:
But it throws a null reference exception for
Parametername: publishedContentRequest
Can't seem to find anything related to the grid when searching for that =/
Any ideas?
Hello,
What happens when you try the following?
Jeroen
Hi Jeroen,
Thanks for chiming in..
Same thing happens, null reference exception for
Parametername: publishedContentRequest
Hmm in that case it might be better to check how it works in the sourcecode: https://github.com/umbraco/Umbraco-CMS/blob/ded1def8e2e7ea1a4fd0f849cc7a3f1f97cd8242/src/Umbraco.Web/GridTemplateExtensions.cs.
Jeroen
Thanks for the link Jeroen,
Doesn't seem to be much I can do with that extension, besides what is already being done above..
I might just end up creating a separate renderview instead.
Hi, Did you manage to create your own RenderView?
Jon
is working on a reply...