I have finally made the move from using usercontrols to making Razor controls instead but I have a problem that I cant seem to fix.
I am using the Ultimate Picker, that from a checkbox picks up a child node defined under a seperate section(from Parent Node). On a page a user can select which of these picks they want on the page. My question is how do you get the NodeId's then use them in a foreach loop. I know how to do this in C# using the getProperty and seperating the array by comma delimating, I'm just not sure how its done in Razor.
This is my razor so far, this basically just outputs all the nodes under a certain node: there is some other logic, which I guess is pretty simple but my Razor knowledge isn't quite there.
No sorry - my question was written hastily, looking for a way to get the nodes given in the Ultimate Picker data type, so if 3 out of the 5 nodes it would pass back 3 nodeId's.
I know in C# I could do something like: Node currentNode = Node.GetCurrent(); string [] testItems = currentNode.GetProperty("myDataTypeName").Value.Split(",");
And that would give me an array of the 3 NodeId's - I am not sure how this would translate in to Razor, or if there would be a better way of doing this in Razor.
Ultimate Picker in Razor
Hi guys,
I have finally made the move from using usercontrols to making Razor controls instead but I have a problem that I cant seem to fix.
I am using the Ultimate Picker, that from a checkbox picks up a child node defined under a seperate section(from Parent Node). On a page a user can select which of these picks they want on the page.
My question is how do you get the NodeId's then use them in a foreach loop. I know how to do this in C# using the getProperty and seperating the array by comma delimating, I'm just not sure how its done in Razor.
This is my razor so far, this basically just outputs all the nodes under a certain node: there is some other logic, which I guess is pretty simple but my Razor knowledge isn't quite there.
Thanks for any help in advance.
Jason
Hi Jason,
Not sure what what you are asking here ! Are you looking for the parent nodeId ?
No sorry - my question was written hastily, looking for a way to get the nodes given in the Ultimate Picker data type, so if 3 out of the 5 nodes it would pass back 3 nodeId's.
I know in C# I could do something like:
Node currentNode = Node.GetCurrent();
string [] testItems = currentNode.GetProperty("myDataTypeName").Value.Split(",");
And that would give me an array of the 3 NodeId's - I am not sure how this would translate in to Razor, or if there would be a better way of doing this in Razor.
Thanks
Right think I've got it, I think it is very similar to C# and it should look like this:
var currentNode = umbraco.NodeFactory.Node.GetCurrent();
var panelStory = @currentNode.GetProperty("panelTest").Value;
string[] tests = panelStory.Split(',');
If anyone knows of an easier way then let me know.
If you're using Razor (in macro's and not MVC) you could probably also do something like this:
Jeroen
is working on a reply...