Hi Moss Devs,
Mnamtafuta webpart Treeview kuonyesha maktaba hati katika mtazamo mti.
Hakuna nje ya webpart sanduku ya kuonyesha hati maktaba katika Treeview.
Nilianza googling ni wakati ya kuanza kufanya kazi katika kazi hii. I got webparts michache ambayo ni kutumia java script kupakia mtazamo mti. Mimi mawazo ya kuendeleza webpart mwenyewe kutoa hati maktaba katika mti kudhibiti mtazamo.
Mimi tumemuumba webpart kutumia. Net 2.0 mti mtazamo kudhibiti na kuchota maktaba hati taarifa kutoka toolpart kutoa data na maoni ya mti.
Kutumia code zifuatazo kupakia habari majani ya mti maoni kutoka maktaba hati.
umma utupu TraverseFolder(SPFolder folds,AspControls.TreeNode node)
{
TreeNode tNode = mpya System.Web.UI.WebControls.TreeNode(folder.Name);
kujaribu
{
kama (folder.Name != “Fomu za”)
{
foreach (SPFolder FLDR katika folder.SubFolders)
{
kama (fldr.Name != “Fomu za”)
{
TreeNode trn = mpya System.Web.UI.WebControls.TreeNode(fldr.Name);
tNode = TraverseFiles(fldr, trn);
rNode.ChildNodes.Add(tNode);
}
}
foreach (SPFile file katika folder.Files)
{
TreeNode trnChild = mpya System.Web.UI.WebControls.TreeNode(file.Name, “”, “~ / _layouts / / Images” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
//trv.Nodes.Add(trnChild);
rNode.ChildNodes.Add(tNode);
}
}
}
catch (Ubaguzi e)
{
Console.WriteLine(e.Message);
}
}
umma TreeNode TraverseFiles(SPFolder FLDR, AspControls.TreeNode node)
{
kujaribu
{
foreach (SPFile file katika fldr.Files)
{
AspControls.TreeNode trnChild = mpya System.Web.UI.WebControls.TreeNode(file.Name, “”, “~ / _layouts / / Images” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
node.ChildNodes.Add(trnChild);
}
bool bRecurseFolders = fldr.SubFolders.Count> 0 ? kweli : uongo;
kama (bRecurseFolders)
{
kwa ajili ya (int i = 0; katika < 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,
Je, i kupata kazi webpart wa kanuni hii. Mimi ni mpya kwa maendeleo lakini i haja hii webpart na Uamuzi wa folders wote na files.
Tafadhali tuma mimi kwenye kdk1983@gmail.com
hi
unaweza eleza nami katika deatil
Iam kuwa na matatizo sawa kama u inaweza kueleza katika maelezo yangu jinsi ya kuendelea .. thenn ingekuwa b kweli greatful
hi
unaweza eleza nami katika maelezo jinsi ya kuendelea..
tafadhali urgentwinadbut yake
Hey Guyz,
Rejea yangu CodePlex Release http://techblog.udayakumar.net/2008/08/treeview-document-library-webpart-v10.html
Shukrani,
~ Uday.
wat hii ina maana? AspControls.TreeNode nodi pls kusaidia