హాయ్ మాస్ Devs,
మీరు TreeView కోసం చూస్తున్నాయి చెట్టు దృష్టిలో పత్రం లైబ్రరీ ప్రదర్శించడానికి webpart.
TreeView పత్రం లైబ్రరీ ప్రదర్శించడానికి అందుబాటులో బాక్స్ webpart సంఖ్య అవుట్ ఉంది.
ఈ పని మీద పని మొదలు నేను ను ప్రారంభించారు. I got few webparts which is using java script to load the tree view. I thought of developing own webpart to render the document library in tree view control.
I have created the webpart using .Net 2.0 tree view control and fetching the document library information from the toolpart to render the data to tree view.
Use the following code to load the leaf information of tree view from the document library.
public void TraverseFolder(SPFolder folder,AspControls.TreeNode node)
{
TreeNode tNode = new System.Web.UI.WebControls.TreeNode(folder.Name);
ప్రయత్నించండి
{
ఉంటే (folder.Name != “పత్రాలు”)
{
foreach (SPFolder fldr in folder.SubFolders)
{
ఉంటే (fldr.Name != “పత్రాలు”)
{
TreeNode trn = new System.Web.UI.WebControls.TreeNode(fldr.Name);
tNode = TraverseFiles(fldr, trn);
rNode.ChildNodes.Add(tNode);
}
}
foreach (SPFile file in folder.Files)
{
TreeNode trnChild = new System.Web.UI.WebControls.TreeNode(file.Name, “”, “~/_layouts/images/” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
//trv.Nodes.Add(trnChild);
rNode.ChildNodes.Add(tNode);
}
}
}
క్యాచ్ (ఎక్సెప్షన్ ఇ)
{
Console.WriteLine(e.Message);
}
}
public TreeNode TraverseFiles(SPFolder fldr, AspControls.TreeNode node)
{
ప్రయత్నించండి
{
foreach (SPFile file in fldr.Files)
{
AspControls.TreeNode trnChild = new System.Web.UI.WebControls.TreeNode(file.Name, “”, “~/_layouts/images/” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
node.ChildNodes.Add(trnChild);
}
bool bRecurseFolders = fldr.SubFolders.Count > 0 ? నిజమైన : తప్పుడు;
ఉంటే (bRecurseFolders)
{
for (int i = 0; i < fldr.SubFolders.Count; i++)
{
TreeNode trnChild = new System.Web.UI.WebControls.TreeNode(fldr.SubFolders[i].Name);
node.ChildNodes.Add(TraverseFiles(fldr.SubFolders[i], trnChild));
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
return node;
}
Use the Traverse Folder function and pass the root element of the document library as parameter.
Now you got a Tree view with appropriate leaf nodes.
Render it in your webpart project 🙂
హాయ్,
Can i get working webpart of this code. I am new to development but i need this webpart with sorting of all folders and files.
Please send me on kdk1983@gmail.com
అక్కడ
can you please explain me in deatil
Iam having the same prob if u can explain me in details how to proceed..thenn it would b really greatful
అక్కడ
can you please explain me in details how to proceed..
please its urgentwinadbut
హే Guyz,
Refer My CodePlex Release http://techblog.udayakumar.net/2008/08/treeview-document-library-webpart-v10.html
ధన్యవాదాలు,
~ ఉదయ్.
wat this means? AspControls.TreeNode node pls help