For example I want to start from "FGM Education Resources for Health Care Proffessionals" and read the Document property of this node, the loop through all its child nodes.
And I want to do the same thing with next sub node "FGM Education Resources for Community Education"
foreach (umbraco.NodeFactory.Node doc in ChNodes) { if (doc.Children.Count > 1) { Label1.Text += doc.Name + "--"; //Print the header
umbraco.NodeFactory.Nodes SubNodes = doc.Children; foreach (umbraco.NodeFactory.Node sdoc in SubNodes) { Label2.Text += sdoc.Name + "--"; //Print the children of each parent } } } }
foreach (umbraco.NodeFactory.Node doc in ChNodes) { Label1.Text += "<b>" + doc.Name + "</b><br />"; //Print the header
//umbraco.NodeFactory.Nodes SubNodes = doc.Children; //foreach (umbraco.NodeFactory.Node sdoc in SubNodes) foreach (umbraco.NodeFactory.Node sdoc in doc.Children) { Label1.Text += sdoc.Name + "<br />"; //Print the children of each parent }
Behandling med Sciton IPL er mer behagelig og tryggere enn vanlig IPL på grunn av innebygd kjøling i behandlingshodet. Dette gjør også at vi kan bruke mer energi og gå dypere i behandlingsområdet uten at det fører til skader på huden.www.kolibrimedical.com,vitalhudklinikk.no,cosmedica.no.
CSharp Code to loop through nodes
Hi
I need some Csharp code to do the following:
For example I want to start from "FGM Education Resources for Health Care Proffessionals" and read the Document property of this node, the loop through all its child nodes.
And I want to do the same thing with next sub node "FGM Education Resources for Community Education"
Many thanks for your help in advance
Kind regards
Praveen
Hi There
umbraco 4.7 / visual studio 2010
I wote some csharpe code but it prints all the parents first and the prnts the child nodes,
what I want is to print each parent and then prints its childrens, can someone please advice on the following code.
private void Populate()
{
umbraco.NodeFactory.Node CurNode = umbraco.NodeFactory.Node.GetCurrent();
umbraco.NodeFactory.Nodes ChNodes = CurNode.Children;
foreach (umbraco.NodeFactory.Node doc in ChNodes)
{
if (doc.Children.Count > 1)
{
Label1.Text += doc.Name + "--"; //Print the header
umbraco.NodeFactory.Nodes SubNodes = doc.Children;
foreach (umbraco.NodeFactory.Node sdoc in SubNodes)
{
Label2.Text += sdoc.Name + "--"; //Print the children of each parent
}
}
}
}
Many thanks for your help
Regards
Praveen
Nailed this one;)
This code works :)
private void Populate()
{
umbraco.NodeFactory.Node CurNode = umbraco.NodeFactory.Node.GetCurrent();
umbraco.NodeFactory.Nodes ChNodes = CurNode.Children;
foreach (umbraco.NodeFactory.Node doc in ChNodes)
{
Label1.Text += "<b>" + doc.Name + "</b><br />"; //Print the header
//umbraco.NodeFactory.Nodes SubNodes = doc.Children;
//foreach (umbraco.NodeFactory.Node sdoc in SubNodes)
foreach (umbraco.NodeFactory.Node sdoc in doc.Children)
{
Label1.Text += sdoc.Name + "<br />"; //Print the children of each parent
}
}
}
Behandling med Sciton IPL er mer behagelig og tryggere enn vanlig IPL på grunn av innebygd kjøling i behandlingshodet. Dette gjør også at vi kan bruke mer energi og gå dypere i behandlingsområdet uten at det fører til skader på huden.www.kolibrimedical.com,vitalhudklinikk.no,cosmedica.no.
is working on a reply...