protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DocEng.TreeProvider cmsTree = new DocEng.TreeProvider(MembershipContext.AuthenticatedUser);
var node = cmsTree.SelectSingleNode(SiteContext.CurrentSiteName, "/", "en-US");
DocEng.TreeNodeCollection myChildren = node.AllChildren;
IEnumerable<DocEng.TreeNode> TreeNodes = myChildren.AsEnumerable<DocEng.TreeNode>();
foreach (var tree in TreeNodes.Where(x => x.NodeLevel == 0))
{
System.Web.UI.WebControls.TreeNode ParenTreeNode = new System.Web.UI.WebControls.TreeNode();
ParenTreeNode.Text = tree.NodeID.ToString() + ". " + SiteContext.CurrentSiteName;
ParenTreeNode.Value = tree.NodeID.ToString();
AddNodes(ParenTreeNode);
tvContentTree.Nodes.Add(ParenTreeNode);
}
}
}
///
/// Adding child for the parent
///
///
private void AddNodes(System.Web.UI.WebControls.TreeNode TreeNode)
{
DocEng.TreeProvider cmsTree = new DocEng.TreeProvider(MembershipContext.AuthenticatedUser);
var node = cmsTree.SelectSingleNode(SiteContext.CurrentSiteName, "/", "en-US");
DocEng.TreeNodeCollection myChildren = node.AllChildren;
IEnumerable<DocEng.TreeNode> childTreeNodes = myChildren.AsEnumerable<DocEng.TreeNode>();
foreach (var childTree in childTreeNodes.Where(x => x.NodeParentID == Convert.ToInt32(TreeNode.Value)))
{
System.Web.UI.WebControls.TreeNode ChildNode = new System.Web.UI.WebControls.TreeNode();
ChildNode.Text = childTree.NodeID.ToString() + ". " + childTree.DocumentName.ToString();
ChildNode.Value = childTree.NodeID.ToString();
TreeNode.ChildNodes.Add(ChildNode);
AddNodes(ChildNode);
if (childTree.NodeLevel == 1)
ChildNode.Collapse();
}
}
1 comment
I am very happy when read this blog post because blog post written in good manner and write on good topic. Thanks for sharing valuable information.
Web Design Company Bangalore,
Digital Marketing Company
Post a Comment