Hi,
how can I read the <items> from a .net usercontrol? myNode.GetProperty("myPropertyAlias").Value.ToString() returns null. Version or Alias work fine.
Thank you!
You can acces the base properties of a node by using myNode.Name, or myNode.Id, or myNode.NodeTypeAlias. Custom added properties are accessed by using the GetProperty() method. myNode.GetProperty("customProperty").Value.
You can read a little more about the use of nodeFactory here our.umbraco.org/.../working-with-the-nodefactory
/Jan
Like I said, I tried to read the <items> using myNode.GetProperty("myPropertyAlias").Value.ToString() but it returns null. All the other properties of the node, custom or not, are ok.
bfi
Please check the database if there is any value or alternatively you can use xslt to confirm if it works in xslt?
As noted by Folkirt & Jan, myNode.GetProperty("customProperty").Value should work fine.
thanks
xslt sample is available at http://umbraco.masoodafzal.com/
I've been having the same experience as the original poster. What I've discovered through trial and error is...
The following works:var content = new umbraco.cms.businesslogic.Content(1234);var prop = content.getProperty("Repeatable");var val = prop.Value; However, using the node factory does not:var node = new Node(1234);var prop = n.GetProperty("Repeatable");var val = prop.Value;The value is null.This is my first day using Umbraco, so I'd appreciate any insight why the node factory wouldn't work, as others claimed it would . The factory does work for the other properties in the node, just not the Repeatable Custom Content. However, using the node factory does not:var node = new Node(1234);var prop = n.GetProperty("Repeatable");var val = prop.Value;The value is null.This is my first day using Umbraco, so I'd appreciate any insight why the node factory wouldn't work, as others claimed it would . The factory does work for the other properties in the node, just not the Repeatable Custom Content.
However, using the node factory does not:var node = new Node(1234);var prop = n.GetProperty("Repeatable");var val = prop.Value;The value is null.This is my first day using Umbraco, so I'd appreciate any insight why the node factory wouldn't work, as others claimed it would . The factory does work for the other properties in the node, just not the Repeatable Custom Content.
Sorry for the partial duplication in my above post; I hope you can tell where it should've ended. Are posts here not editable?
AbsCoder
Can you please confirm if other properties on same node return correct value? Just to check if node is published?
Masood
Hello, Masood. Yes, the other properties are correct. I'm fairly certain it's published -- if I use an XSLT macro, the Repeatable Custom Content values are populated with the expected content. I assume that means it's published.
First of all, you shouldn't use the umbraco.cms namespace for frontend retrieving of data (presentation). There you should use the NodeFactory mentioned by Jan before: our.umbraco.org/.../working-with-the-nodefactory
Dirk had a good blogpost about the difference: www.netaddicts.be/.../...t-api-vs-nodefactory.aspx
Second, if you are using the umbraco cms namespace you should use the umbraco.cms.businesslogic.web.Document...
Take a look into the wiki describing the usage of this namespace: our.umbraco.org/wiki/reference/api-cheatsheet
hth, Thomas