I can't get to one of my properties in the Razor markup. I've added the this piece of code in code behind:
var childPages = CurrentPage.Children.OrderByDescending(x => x.CreateDate);
ViewBag.Threads = childPages;
I can do a foreach on these in markup and get to all the common properties like Name, Id, CreateDate, etc. but when I try to get one of my custom properties the closest I get is @thread.GetProperty("owner").ToString() wich gives me Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty but I can't get the value. How do I do this?
Can't get to property in Razor markup
I can't get to one of my properties in the Razor markup. I've added the this piece of code in code behind:
I can do a foreach on these in markup and get to all the common properties like Name, Id, CreateDate, etc. but when I try to get one of my custom properties the closest I get is @thread.GetProperty("owner").ToString() wich gives me Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty but I can't get the value. How do I do this?
It code behind the code below works great but in Razor it crashes and says that there's no definition for Value.
item.GetProperty("owner").Value.ToString();
The value might not be set. You can check it with:
.HasProperty(string propertyAlias) - Returns a boolean value representing if the DynamicNode has a property with the specified alias.
.HasValue(string propertyAlias) - Retruns a boolean value representing if the DynamicNode property has had a value set.
It's set. I know so.
If I do this I get it:
@{
umbraco.NodeFactory.Node node = new umbraco.NodeFactory.Node(thread.Id);
}
@node.GetProperty("owner").ToString();
Isn't it just @thread.Owner ?
is working on a reply...