In your usercontrol, make sure that you have a reference to the umbraco.dll.
Then do something like this:
using System;
using System.Collections.Generic;
using System.Web.UI;
using umbraco.presentation.nodeFactory;
namespace Your.Namespace
{
public class WebUserControl1 : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
var currentNode = Node.GetCurrent();
var children = new List<Node>();
foreach (Node child in currentNode.Children)
{
if (child.NodeTypeAlias == "gallery")
children.Add(child);
}
}
}
}
Then you can use the children list for whatever you need it.
find childnode of specific documenttype
Hello folks.,
very happy new year to all..
i need to find childnode of specific documenttype .
example : i have a node (it is a parentnode).
it has child nodes and decendant node of child.
i need to find nodes of specific documentype(here gallery) in all these child and decendant nodes using usercontrol(C#). any siggestions?
thank you
In your usercontrol, make sure that you have a reference to the umbraco.dll.
Then do something like this:
Then you can use the children list for whatever you need it.
if you were working from a Document rather than a Node you can do something like
but I think the above is database intensive so you're better to do this
http://our.umbraco.org/wiki/reference/api-cheatsheet/enumerating-documents
but you're better using nodes instead of documents anyway
is working on a reply...