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'm trying to use IPublishedContent in my controller so instead of Model.Content I want to just call Model
In the view, you just use
inherit UmbracoViewPage<IPublishedContent> instead of UmbracoTemplatePage
Currently my controller is this in the most simple form
public class TestDocument : Umbraco.Web.Mvc.RenderMvcController
public override ActionResult Index(RenderModel model)
Also, how do i get property values here, I have tried the default Model.Content.GetPropertyValue<string>("valueHere"); or model.Content.GetPropertyValue<string>("valueHere"); wat but its not having that?
You can get the current page like this:
model.Content is IPublishedContent, so you should be able to use .GetPropertyValue
Other option: use CurrentPage, which is also IPublishedContent
Hi Great! It worked!
How would I then get this property in my view?
Exactly the same way, you said your view is now a
so Model will be of IPublishedContent. Again, adding the import statement should be enough to get this working in the view
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted