So, what I want to add to this is a var p = Umbraco.Content(item.ProductId) in the beginning of the foreach-loop for various reasons. But when I try to do this I get an CS0234: The type or namespace name Content does not exist in the namespace Umbraco-error.
I havenĀ“t worked with PartialView yet, but I know from my working with Razor i macroScript, the Razor engine wil throwan error if you have an @ in front of Model in the foreach loop.
So you could try to remove it an see if it solve your problem.
Can't use Umbraco.Content
Sorry for the arbitrary headline but I lack the correct umbraco terminology.
The problem:
I'm using a PartialView that looks like the following:
So, what I want to add to this is a
var p = Umbraco.Content(item.ProductId)
in the beginning of theforeach
-loop for various reasons. But when I try to do this I get anCS0234: The type or namespace name Content does not exist in the namespace Umbraco
-error.What am I missing?
Hi Nikola,
You need to inherit from Umbraco.Web.Mvc.UmbracoViewPage, e.g.
@inherits Umbraco.Web.Mvc.UmbracoViewPage<IEnumerable<CartItemModel>>
More information here
Jeavon
HI Nikola,
I havenĀ“t worked with PartialView yet, but I know from my working with Razor i macroScript, the Razor engine wil throw an error if you have an @ in front of Model in the foreach loop.
So you could try to remove it an see if it solve your problem.
/Dennis
Thank you Jeavon, that did the trick!
Perfect!
is working on a reply...