Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anton Gildebrand 49 posts 149 karma points c-trib
    Feb 10, 2015 @ 10:17
    Anton Gildebrand
    0

    CurrentPage doesn't exist in current context

    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?

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Feb 10, 2015 @ 10:18
    Jeavon Leopold
    0

    Hi Anton,

    Could you please post your entire .cshtml file contents?

    Jeavon

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Feb 10, 2015 @ 10:24
    Dennis Aaen
    0

    Hi Anton,

    Perhaps you are in strongly typed Razor, if this the case, then you should be able to do like this:

    @Model.Content.GetGridHtml("propertyAlias")

    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,

    /Dennis

  • Anton Gildebrand 49 posts 149 karma points c-trib
    Feb 10, 2015 @ 10:50
    Anton Gildebrand
    0

    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>
  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Feb 10, 2015 @ 11:00
    Dennis Aaen
    1

    Hi Anton,

    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.

    Hope this helps,

    /Dennis

  • Anton Gildebrand 49 posts 149 karma points c-trib
    Feb 17, 2015 @ 11:49
    Anton Gildebrand
    0

    Hi again,

    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.

Please Sign in or register to post replies

Write your reply to:

Draft