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 am trying to use CurrentPage.GetGridHtml in a page template, but when I do I get the error "CurrentPage doesn't exist in the current context". The defaultRenderingEngine is set to MVC. Why is this not working?
Could you please post your entire .cshtml file contents?
Perhaps you are in strongly typed Razor, if this the case, then you should be able to do like this:
Try to see this documentation. https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/built-in-property-editors-v7/grid-layout#Rendergridintemplate
Hope this helps,
Here is the entire CSHTML file. I've tried using Model.Content.GetGridHtml as well but that renders in the error "'System.Web.HtmlString' does not contain a definition for 'GetGridHtml'"
<%@ Master Language="C#" MasterPageFile="~/masterpages/MyMaster.master" AutoEventWireup="true" %> <asp:Content ContentPlaceHolderId="MainContent" runat="server"> <umbraco:Macro Alias="Breadcrumb" runat="server"/> <div class="col3"> <div class="column-left"> <umbraco:Macro Alias="Vänstermeny" runat="server" /> </div> <div class="column-middle"> <umbraco:Macro runat="server" language="cshtml"> @CurrentPage.GetGridHtml("gridContent") </umbraco:Macro> </div> <div class="column-right"> <umbraco:Item field="rightContent" runat="server" /> </div> </div> </asp:Content>
From the snippet of code that you have inserted, it looks to me that you are still in WebForms mode, and not MVC. Did you restart the app pool after doing this changes to switch to MVC.
I still havent been able to solve this. Umbraco is indeed in MVC mode. I've restarted the app pool like a hundred times. Nothing I've tried is working. Just to make it clear, I want to use the GetGridHtml in a template.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted