But for some reason it has been rolled back to the original edit... I would try to roll it forwards but the history functionality dosn't seem to be working in chrome firefox or IE at the moment :/
Here is the code I used:
XPathNodeIterator otherAgencyAdmins = umbraco.library.GetXmlNodeByXPath("//Admin[@isDoc and agencyID = '" + agencyId + "']");
System.Collections.IEnumerator otherAgencyAdminsEnumerator = otherAgencyAdmins.GetEnumerator();
while (otherAgencyAdminsEnumerator.MoveNext())
{
XPathNavigator CurrentNode = (XPathNavigator)otherAgencyAdminsEnumerator.Current;
String strAdminRecordId = CurrentNode.GetAttribute("id", String.Empty);
//do something with node id
}
CS: Getting number of nodes with specific properties
Hi all,
I need to count the number of nodes that have a specific property value in a csharp user control.
The nodes that i need to count live under a sibling of the node that the usercontrol will be rendered on.
The following xPath gets the nodes that I need:
$currentPage/../child::AdminContainer/Admin[@isDoc]
How do I get them and count them in csharp using the umbraco api?
I have tried using umbraco.library.GetXmlNodeByXPath but I cannot use the $currentPage variable in cs.
Thanks,
Max.
Sorry, xPath should be:
$currentPage/../child::AdminContainer/Admin[@isDoc and x = 1 and y = 2]
(to check node property values)
I found a solution and did update the documentation for the GetXmlNodeByXPath method here:
http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyxpath
But for some reason it has been rolled back to the original edit... I would try to roll it forwards but the history functionality dosn't seem to be working in chrome firefox or IE at the moment :/
Here is the code I used:
Note: The $currentPage variable is unavailable in the c# context as the umbraco namespaces and xslt extensions have not been loaded.
is working on a reply...