Hi Moss Devs,
Bhfuil tú ag lorg WebPart Treeview a thaispeáint ar an leabharlann doiciméad i bhfianaise crann.
Níl aon amach as an WebPart bhosca atá ar fáil a thaispeáint ar an leabharlann doiciméad i Treeview.
Thosaigh mé dteagmháil leis an seoltóir é nuair a thosaigh ag obair ar an tasc seo. Fuair mé cúpla webparts atá ag baint úsáide as script java a luchtú an dearcadh crann. Shíl mé ar WebPart féin a fhorbairt i gcóir chun an doiciméad leabharlann i bhfianaise rialú crann.
Chruthaigh mé an WebPart ag baint úsáide as .Net 2.0 rialú dearcadh crann agus an t-eolas leabharlann doiciméad ag fáil ón toolpart i gcóir chun na sonraí atá le dearcadh crann.
Bain úsáid as an cód seo a leanas a luchtú an t-eolas duille de chrainn ón leabharlann doiciméad.
TraverseFolder neamhní poiblí(Fillteán SPFolder,AspControls.TreeNode nód)
{
TreeNode tNode = System.Web.UI.WebControls.TreeNode nua(folder.Name);
déan iarracht
{
más rud é (folder.Name != “Foirmeacha”)
{
foreach (Fldr SPFolder i folder.SubFolders)
{
más rud é (fldr.Name != “Foirmeacha”)
{
TreeNode TRN = System.Web.UI.WebControls.TreeNode nua(fldr.Name);
tNode = TraverseFiles(FLDR, thorn);
rNode.ChildNodes.Add(tNode);
}
}
foreach (Comhad SPFile i folder.Files)
{
TreeNode trnChild = System.Web.UI.WebControls.TreeNode nua(file.Name, “”, “~ / _layouts / Images /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
//trv.Nodes.Add(trnChild);
rNode.ChildNodes.Add(tNode);
}
}
}
ghabháil (Eisceacht e)
{
Console.WriteLine(e.Message);
}
}
TraverseFiles TreeNode poiblí(SPFolder FLDR, AspControls.TreeNode nód)
{
déan iarracht
{
foreach (Comhad SPFile i fldr.Files)
{
AspControls.TreeNode trnChild = System.Web.UI.WebControls.TreeNode nua(file.Name, “”, “~ / _layouts / Images /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
node.ChildNodes.Add(trnChild);
}
bool bRecurseFolders = fldr.SubFolders.Count & gt; 0 ? fíor : bréagach;
más rud é (bRecurseFolders)
{
le haghaidh (shlánuimhir 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 🙂
Dia duit,
An féidir liom a fháil WebPart an cód seo ag obair. Tá mé nua a fhorbairt ach is gá mé an WebPart le sórtáil de gach fillteáin agus comhaid.
Cuir chugam ar kdk1983@gmail.com
Tá
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
Tá
Is féidir leat le do thoil a mhíniú dom i bhfoirm sonraí conas dul ar aghaidh..
le do thoil a urgentwinadbut
Hey Guyz,
Déan tagairt Mo CodePlex Scaoileadh http://techblog.udayakumar.net/2008/08/treeview-document-library-webpart-v10.html
Go raibh maith agat,
~ Uday.
wat ciallaíonn seo? AspControls.TreeNode cabhrú pls nód