Hi I am having a lot of trouble with rendering an umbraco grid.
I have a solution with umbraco 7.6 and MVC. So in my controller I want to try and add the rendered grid to my model, so I can call that model in the view.
In my controller:
public ActionResult BlogItem()
{
var model = new BlogItemViewModel();
// GET grid 1
var aboutGrid = CurrentPage.GetGridHtml("gridLayout");
//add to model.
model.GridLayout = new HtmlString(aboutGrid.ToHtmlString());
return View(model);
}
And in my view I should be able to just call this:
@Model.GridLayout
But I get an exception, which doesn't really tell me much in my controller when trying to call it.
System.Web.HttpCompileException: 'External component has thrown an exception.'
$exception error CS0246: The type or namespace name 'UmbracoViewPage' could not be found (are you missing a using directive or an assembly reference?)"} System.Web.HttpCompileException
Edit 1
@model Carinas_Univers.Models.BlogItemViewModel
@{
Layout = "Master.cshtml";
}
i have a view model, master page, and a master controller. the mastercontroller inherits from RenderMvcController