the standard treeView control has classes such as "TreeNodeCollection" and "TreeNode", is there any such classes using the radTreeView?
im converting the following code to work with the rad control, it builds a tree menu from an sql database using recursive response and the treeNode and treeNodeParant standard used by MS.
it both builds the menu and checks the right to edit and access the treeNodes using a Active Directory based class along with a class to handle all the SQL database access.
public
partial class menul : System.Web.UI.UserControl
{
protected void Page_PreRender(object sender, EventArgs e)
{
if (!IsPostBack)
{
dsLocal.RightsDataTable dtSeed = new dsLocal.RightsDataTable();
dsLocal.RightsRow dr = dtSeed.NewRightsRow();
dr.MenuID = -1;
dr.AdGroup = sesvar.not_authenticated;
dr.Hide = false;
dr.Write = false;
dtSeed.Rows.Add(dr);
TreeNodeCollection tc = dataAccess.getNodes(-1, Session.SessionID, dtSeed, null, 0);
treeMenu1.Nodes.Clear();
foreach (TreeNode tn in tc)
{
treeMenu1.Nodes.Add(tn);
}
tc = dataAccess.getNodes(-2, Session.SessionID, dtSeed, null, 0);
treeMenu2.Nodes.Clear();
foreach (TreeNode tn in tc)
{
treeMenu2.Nodes.Add(tn);
}
tc = dataAccess.getNodes(-3, Session.SessionID, dtSeed, null, 0);
treeMenu3.Nodes.Clear();
foreach (TreeNode tn in tc)
{
treeMenu3.Nodes.Add(tn);
}
if (Session[sesvar.pageID] != null)
{
TreeNode foundNode = FindPageID(treeMeny1, (int)Session[sesvar.pageID]);
foundNode = FindPageID(treeMenu2, (int)Session[sesvar.pageID]);
foundNode = FindPageID(treeMenu3, (int)Session[sesvar.pageID]);
}
}
}
private TreeNode FindPageID(TreeView Tree, int PageID)
{
foreach (TreeNode nod in Tree.Nodes)
{
int testID = 0;
if (int.TryParse(nod.Value, out testID) && testID == PageID)
{
nod.Select();
return nod;
}
else
{
TreeNode tmpNode = FindPageID(nod, PageID);
if (tmpNode != null)
{
nod.Expand();
return tmpNode;
}
}
}
return null;
}
private TreeNode FindPageID(TreeNode Tree, int PageID)
{
foreach (TreeNode nod in Tree.ChildNodes)
{
int testID = 0;
if (int.TryParse(nod.Value, out testID) && testID == PageID)
{
nod.Select();
return nod;
}
else
{
TreeNode tmpNode = FindPageID(nod, PageID);
if (tmpNode != null)
{
nod.Expand();
return tmpNode;
}
}
}
return null;
}
}
Any help re-doing this code snippet to be handled by the radTreeview would be appriciated.
Thanks in advance
Christian Persson
IT-Consultant - Netred AB
Sweden