It is picking a bunch of images and then I want to randomly display one of those images as the background.
I have this:
Node thisPage = Node.GetCurrent();
and usually use this to get the value of a property on the page:
thisPage.GetProperty("heroImage").Value
However, doing this for the repeatable datatype gives me empty string for the value.
I am wondering how to get the node for heroImage and do I have to use regular xml operations on it or if there is someway to get those items using the umbraco API.
(Firstly, on a side-point, you might get a response from the Repeatable Custom Content developer if you posted in his support form)
I have personally use the Repeatable Custom Content with code-behind (C#) - but the property value should return a String (an XML string, which would need to be loaded into an XmlDocument, or similar?) Which should have this structure.
If there is no value returned, then there might be something wrong with your set-up? It's worth checking in your cmsPropertyData database table to see if the node has any values, (might look a bit scary if you don't know databases). Otherwise check your umbraco.config to see if the value is in there.
Once you get the XML (String) back, do a couple of SelectNodes/XPath and you should get the value you need.
Getting multiple node values in code
I am using a repeatable custom content datatype and I want to get those values in my code, not on an xslt page.
It is picking a bunch of images and then I want to randomly display one of those images as the background.
I have this:
Node thisPage = Node.GetCurrent();
and usually use this to get the value of a property on the page:
thisPage.GetProperty("heroImage").Value
However, doing this for the repeatable datatype gives me empty string for the value.
I am wondering how to get the node for heroImage and do I have to use regular xml operations on it or if there is someway to get those items using the umbraco API.
Thanks
Hi Karen,
(Firstly, on a side-point, you might get a response from the Repeatable Custom Content developer if you posted in his support form)
I have personally use the Repeatable Custom Content with code-behind (C#) - but the property value should return a String (an XML string, which would need to be loaded into an XmlDocument, or similar?) Which should have this structure.
If there is no value returned, then there might be something wrong with your set-up? It's worth checking in your cmsPropertyData database table to see if the node has any values, (might look a bit scary if you don't know databases). Otherwise check your umbraco.config to see if the value is in there.
Once you get the XML (String) back, do a couple of SelectNodes/XPath and you should get the value you need.
Good luck, Lee.
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.