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:-
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!
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!
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.
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
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
Hi Jonathan,
What if you try to change your template so it looks like this.
Hope this helps,
/Dennis
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
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:
/Dennis
Almost, the template 'HomePage' looks like this:-
Thanks,
Jonathan
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
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
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
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)
Thanks
Jonathan
Hi Dennis,
I was just wondering if you'd had any luck installing U7 on Umbraco v7.x?
Many thanks
Jonathan
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
Hope this helps,
/Dennis
Have you created any content that used BannersHome.cshtml?
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
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.