Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've media picker in Umbraco 8 and I want to display image in my cshtml page.
@inherits Umbraco.Web.Mvc.UmbracoViewPage @{ Layout = "~/Views/Shared/_Layout.cshtml"; } <body> <section class="section"> <div class="page-header-box"> <img src="images/Leadership.png" /> </div> <div class="ld-content-box gradientbackground"> <div class="inner-container"> <h3 class="ip-title">Leadership</h3> <ul class="aboutus-leadership-listing"> @foreach (var childPage in Model.Children()) { <li data-aos="fade-up"> <div class="abll-image-box"> @{ var leaderImage = childPage.Value<IPublishedContent>("leaderImage"); }
But I am getting error :
The type or namespace name 'IPublishedContent' could not be found (are you missing a using directive or an assembly reference?)
I don't it is issue because of Umbraco V8 or is there anything missing?
Hello Hardik,
Try to update the view/web.config file like this. As I have seen the config code, some namespace is not available in your config file. Try the below section in your file. Hope your problem will be fixed.
<system.web.webPages.razor> <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <pages pageBaseType="System.Web.Mvc.WebViewPage"> <namespaces> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> <add namespace="Umbraco.Web" /> <add namespace="Umbraco.Core" /> <add namespace="Umbraco.Core.Models" /> <add namespace="Umbraco.Core.Models.PublishedContent" /> <add namespace="Umbraco.Web.Mvc" /> <add namespace="Examine" /> <add namespace="Umbraco.Web.PublishedModels" /> </namespaces> </pages> </system.web.webPages.razor>
Nope. that is also not working. do I need to import anything in cshtml?
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.
Continue discussion
The type or namespace name 'IPublishedContent' could not be found Umbraco 8
I've media picker in Umbraco 8 and I want to display image in my cshtml page.
But I am getting error :
I don't it is issue because of Umbraco V8 or is there anything missing?
Hello Hardik,
Try to update the view/web.config file like this. As I have seen the config code, some namespace is not available in your config file. Try the below section in your file. Hope your problem will be fixed.
Nope. that is also not working. do I need to import anything in cshtml?
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.