I've earlier gotten help to create this for-each sentence in the Codebehind of a usercontrol. The language is CS.
dynamic afd = new umbraco.MacroEngines.DynamicNode(umbraco.NodeFactory.Node.GetCurrent()); var Afdeling = afd.findAfdeling; var parent = afd.NodeById(afd.Afdelinger); System.Collections.Generic.List<string> afdnavne = new System.Collections.Generic.List<string>();
if (parent != null) { foreach (var item in parent.Children.Where("Visible && " + Afdeling)) { afdnavne.Add(@item.firmanavn); }; };
On the "item"-document-type i have a property with the alias "firmaNavn", but if I add a .OrderBy("firmaNavn") then I get an error that the usercontrol cannot compile.
Another option was to change it to order by NodeName, but changing it to:
.OrderBy("Name")
removes the error - but doesn't order it correctly. But if I put
.OrderBy("Id")
it orders the list in the order which i created the nodes :-) That will work for now, but sometime in the future it will give me a problem.
Order by not working i codebehind
Hi Guys
I've earlier gotten help to create this for-each sentence in the Codebehind of a usercontrol. The language is CS.
On the "item"-document-type i have a property with the alias "firmaNavn", but if I add a .OrderBy("firmaNavn") then I get an error that the usercontrol cannot compile.
Another option was to change it to order by NodeName, but changing it to:
removes the error - but doesn't order it correctly. But if I put
it orders the list in the order which i created the nodes :-) That will work for now, but sometime in the future it will give me a problem.
What am I doing wrong?
Jimmy Dan Mortensen
Hi, what version are you using?
Please check with 4.7.1.1.
I am pretty sure that nodeName (case sensitive) will work though.
Sorry for the late reply ... Things have been crazy
I'm using this version: "umbraco v 4.7.1 (Assembly version: 1.0.4281.20201)"
But nodeName is working so I'm happy :-)
is working on a reply...