Replies
Please I need this urgent. I'm waiting for many days.
Thanks.
This is what I have in the page load:
if (!IsPostBack) {
foreach (var nodeStructure in ListStructure)
{
DataTreeNode nodo = new DataTreeNode();
nodo.Attributes.Add("Estructura", nodeStructure.Id.ToString());
nodo.Text = nodeStructure.Nombre;
LoadHierarchy(nodo, nodeStructure);
tree.Nodes.Add(nodo);
}
var nodes = from DataTreeNode nodo in tree.AllNodes
where !string.IsNullOrEmpty(nodo.Key)
select nodo;
int order = 1;
foreach (DataTreeNode nodo in nodes)
{
nodo.Attributes.Add("Order", order.ToString());
order++;
}
}
And this is the recursive method:
private void LoadHierarchy(DataTreeNode nodoPadre, ModuloContenido contenidoPadre)
{
foreach (var nodoContenidoHijo in contenidoPadre.ColModuloContenidoHijos)
{
DataTreeNode nodoHijo = new DataTreeNode();
nodoHijo.Attributes.Add("Estructura", nodoContenidoHijo.IdModuloContenido.ToString());
nodoHijo.Text = nodoContenidoHijo.Nombre;
ArmarJerarquia(nodoHijo, nodoContenidoHijo);
nodoPadre.Nodes.Add(nodoHijo);
}
}
After a click in the node, the attributes are missing, but not all of them, the "Order" attribute still remains.
Thanks in advance for the help.