I use Umbraco v4, but think this should be a common problem.
I have a generic property "myNode" of "Content Picker", that should obtain a DynamicNode...
so doying myObj.myNode
I obtain the node itself... so can use myObj.myNode.Url
But doying the myObj.GetPropertyValue("myNode")
I obtain the ... string ID value of the node... so can't anymore do myObj.GetPropertyValue("myNode").Url
(string does not have Url
property)
I can't use directly myObj.myNode, because the name is "dynamic" (the same function should use "your"+"Node" or "their"+"Node" upon conditions - the example is very aproximative, but hope the idea is clear)...
I even did myObj.GetPropertyValue<DynamicNode>("myNode")
, but the result was the same: "8124" (the node id)
So, how to obtain the real property value, not just string representation of it?
A not so elegant solution, but at least a solution that work:
var linkNode = image.GetPropertyValue("imgLinkNode" + model._lang.ToUpper());
if (linkNode is string)
{
string id = linkNode;
linkNode = model.NodeById(id);
}
var linkNodeUrl = linkNode.Url;