Hi everyone,
I am trying to access the Content() method of the UmbracoHelper class with the Umbraco property which is in the UmbracoViewPage like this
Umbraco.Content() in a Razor view.
But I am getting this error
The type or namespace name 'Content' does not exist in the namespace Umbraco.
I have also tried to inject the UmbracoViewPage directly in the razor page and using the method, that way I don't get any compilation errors but i get runtime error in Program.cs.
While Injecting I am adding the following code in startup.cs
services.AddTransient<UmbracoViewPage>();
Still it is not able to resolve it.
Is there any other way to call the Content() method in the Razor page or am I making a mistake somewhere?
Thank you.
Umbraco.Content() inside a Razor page
Hi everyone, I am trying to access the Content() method of the UmbracoHelper class with the Umbraco property which is in the UmbracoViewPage like this
Umbraco.Content()
in a Razor view. But I am getting this errorI have also tried to inject the UmbracoViewPage directly in the razor page and using the method, that way I don't get any compilation errors but i get runtime error in Program.cs. While Injecting I am adding the following code in startup.cs
Still it is not able to resolve it. Is there any other way to call the Content() method in the Razor page or am I making a mistake somewhere? Thank you.
Hi Souvik,
Something must have gone wrong in your view file - what does the first few lines look like? Does it inherit from
UmbracoViewPage
?/Chriztian
is working on a reply...