Copied to clipboard

Flag this post as spam?

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


  • IT Inbox 10 posts 31 karma points
    Jun 08, 2016 @ 16:39
    IT Inbox
    0

    The name 'CurrentPage' does not exist in the current context

    Hi all,

    Hopefully someone can help me with this most frustrating of issues!

    Currently we are on v6.2.4 and I am in the process of upgrading to v7 and then onto whatever is the latest iteration (v7.4.3 at present). We have the MultiType DataType v1.1.1 package installed however as this is not compatible with v7 this has now been uninstalled and the only package I can find that supports multi type is U7 Grid Data Type.

    U7 installs successfully however when trying to update an existing Scripting File I am now getting the following error - "The name 'CurrentPage' does not exist in the current context". The code in the scripting file (purely for testing) is:-

    @using Umbraco.Web @using Umbraco.Web.Mvc @inherits UmbracoTemplatePage @inherits System.Web.WebPages.WebPage

    @{ Layout = null; }

    @CurrentPage.Name

    I have changed the default rendering engine from WebForms to Mvc, restarted IIS and the AppPool but the same error appears. I have now also tried setting up a new installation of v7 in case there was a problem during the upgrade but I get the exact same error message on this too.

    Trawling the web there are suggestions that .Net 4.5 needs to be installed but I have checked and it is definitely installed.

    Any help would be greatly appreciated as this upgrade has now come to a griding halt!

    Thanks Jonathan

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 08, 2016 @ 16:53
    Dennis Aaen
    0

    Hi Jonathan,

    What if you try to change your template so it looks like this.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = null;
    }
    
    @CurrentPage.Name
    

    Hope this helps,

    /Dennis

  • IT Inbox 10 posts 31 karma points
    Jun 08, 2016 @ 17:11
    IT Inbox
    0

    Hi Dennis,

    Many thanks for your reply. Changing the code as you've suggested then results in the error "Context Must Implement System.Web.WebPages.WebPage". After adding back the line "@inherits System.Web.WebPages.WebPage" we are then back to the original error message!

    Thanks Jonathan

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 08, 2016 @ 17:23
    Dennis Aaen
    0

    Hi Jonathan,

    If you are trying to add a new document type that includes a template, and called it e.g HomePage.

    Did you then see that the template contains something like this:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.HomePage>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = null;
    }
    

    /Dennis

  • IT Inbox 10 posts 31 karma points
    Jun 08, 2016 @ 17:29
    IT Inbox
    0

    Almost, the template 'HomePage' looks like this:-

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = null;
    }
    

    Thanks,
    Jonathan

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 08, 2016 @ 17:35
    Dennis Aaen
    0

    Hi Jonathan,

    Did you follow the general upgrade guide? https://our.umbraco.org/documentation/getting-started/setup/upgrading/general

    In the specific upgrade guide you also need to do something when you upgrade to Umbraco 7.4.3 e,g see this.

    https://our.umbraco.org/documentation/getting-started/setup/upgrading/version-specific

    Hope this helps,

    /Dennis

  • IT Inbox 10 posts 31 karma points
    Jun 08, 2016 @ 17:39
    IT Inbox
    0

    Hi Dennis,

    Yes, I am following the general and the specific upgrade guides however because I was unsure if it was related to the upgrade, I installed a brand new installation of v7 rather than upgrading and I get the same errors on this fresh installation.

    Is it working for you?

    Thanks,
    Jonathan

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 08, 2016 @ 17:45
    Dennis Aaen
    0

    Hi Jonathan,

    Okay I will try it out, so you have installed 4.7.3 and then installed the https://our.umbraco.org/projects/backoffice-extensions/u7-grid-data-type/

    Then created a document type with a template and trying print out @CurrentPage.Name right?

    /Dennis

  • IT Inbox 10 posts 31 karma points
    Jun 09, 2016 @ 09:59
    IT Inbox
    0

    Hi Dennis,

    No, I'd only got as far as upgrading to v7.2.0 before I noticed the issue with MultiType DataType, hence the installation of U7.

    However, I have only installed v7.0 from fresh but both versions are giving the same result.

    The error occurs when creating a scripting file (see screen shot) Scripting File Error

    Thanks
    Jonathan

  • IT Inbox 10 posts 31 karma points
    Jun 29, 2016 @ 13:13
    IT Inbox
    0

    Hi Dennis,

    I was just wondering if you'd had any luck installing U7 on Umbraco v7.x?

    Many thanks
    Jonathan

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 29, 2016 @ 17:34
    Dennis Aaen
    0

    Hi Jonathan,

    I have just tried to install the package on Umbraco 7.2.8 and I have no issue with the installing of the package.

    I configure the data type and the got the data out of the page by using something like this

    <div>    
        @foreach (var dog in CurrentPage.dogs)
        {
            <div>
                <p>Name - @dog.name </p>
                @* Editor content - parse internal links *@
                <p>@Html.Raw(umbraco.template.ParseInternalLinks(dog.description.ToString()))           </p>
                @* Media picker - single *@
                @if (dog.image != "") {
                IPublishedContent dogImage=Umbraco.TypedMedia(dog.image.ToString());
                    <img src="@dogImage.Url" />
                }
                @* Media picker multiple - split the id's *@
                @if (dog.images != "") {
                    foreach (var item in dog.images.ToString().Split(','))
                    {
                IPublishedContent dogImage = Umbraco.TypedMedia(item);
                    <img src="@dogImage.Url" />
                    }
                }
                @* Content picker multiple *@
                @if (dog.brothers != ""){
                    foreach (var item in dog.brothers.ToString().Split(','))
                    {
                // get link 
                var contentLink = Umbraco.NiceUrl(int.Parse(item));
                // get node
                dynamic pickerNode = new umbraco.MacroEngines.DynamicNode(item);
                <a href="@contentLink">@pickerNode.Name</a>
                    }
                }           
                @* Check box *@
                @if (dog.trained == "True")
                {
                    <p>This dog is traind.</p>
                }
            </div>
        }
    </div>
    

    Hope this helps,

    /Dennis

  • Jinesh Kaneriya 22 posts 155 karma points
    Jun 29, 2016 @ 13:35
    Jinesh Kaneriya
    0

    Have you created any content that used BannersHome.cshtml?

  • IT Inbox 10 posts 31 karma points
    Jun 29, 2016 @ 14:27
    IT Inbox
    0

    Hi,

    In our live and test environments yes there is content that uses BannersHome.cshtml. In the vanilla installation of v7.0 there isn't but it errors when saving the scripting file as per the screen shot

    Thanks
    Jonathan

Please Sign in or register to post replies

Write your reply to:

Draft