Kumusta Moss Devs,
Naghahanap ka ba ng Treeview webpart upang ipakita ang mga dokumento library sa tree view.
Walang sumali sa kahon webpart magagamit upang ipakita ang mga dokumento library sa Treeview.
Nagsimula ako sa Pag-Google kapag nagsimula nagtatrabaho sa gawaing ito. Mayroon akong ilang webparts na gamit ang java script upang i-load ang tree view. Akala ko ng pagbuo ng sariling webpart upang mag-render ang dokumento library sa control tanawin puno.
Ko nilikha ang webpart gamit ang .net 2.0 tree view kontrol at pagkuha ng mga impormasyon ng dokumento library mula sa toolpart upang mag-render ang data sa tree view.
Gamitin ang sumusunod na code upang i-load ang impormasyon ng dahon ng tree view mula sa dokumento library.
pampublikong void TraverseFolder(SPFolder folder,AspControls.TreeNode node)
{
TreeNode tNode = bagong System.Web.UI.WebControls.TreeNode(folder.Name);
sumubok
{
kung (folder.Name != “Mga Form”)
{
foreach (SPFolder fldr sa folder.SubFolders)
{
kung (fldr.Name != “Mga Form”)
{
TreeNode trn = bagong System.Web.UI.WebControls.TreeNode(fldr.Name);
tNode = TraverseFiles(FLDR, tinik);
rNode.ChildNodes.Add(tNode);
}
}
foreach (SPFile file sa folder.Files)
{
TreeNode trnChild = bagong System.Web.UI.WebControls.TreeNode(file.Name, “”, “~ / _layouts / Mga larawan /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
//trv.Nodes.Add(trnChild);
rNode.ChildNodes.Add(tNode);
}
}
}
hulihin (Exception e)
{
Console.WriteLine(e.Message);
}
}
pampublikong TreeNode TraverseFiles(SPFolder FLDR, AspControls.TreeNode node)
{
sumubok
{
foreach (SPFile file sa fldr.Files)
{
AspControls.TreeNode trnChild = bagong System.Web.UI.WebControls.TreeNode(file.Name, “”, “~ / _layouts / Mga larawan /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
node.ChildNodes.Add(trnChild);
}
bool bRecurseFolders = fldr.SubFolders.Count & gt; 0 ? totoo : hindi totoo;
kung (bRecurseFolders)
{
para (int i = 0; sa < 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 🙂
Hi,
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
Doon
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
Doon
can you please explain me in details how to proceed..
please its urgentwinadbut
Hey Guyz,
Refer My CodePlex Release http://techblog.udayakumar.net/2008/08/treeview-document-library-webpart-v10.html
Salamat,
~ Uday.
wat this means? AspControls.TreeNode node pls help