我工作在三個層面上結合我Telerik的TreeView的多層次的TreeView
+Directories
*Archives
-Documents
*Directories
這是我的代碼:
<% Html.Telerik().TreeView()
.Name("TeleTreeView")
.DragAndDrop(true)
.ExpandAll(true)
.BindTo(Model, mappings =>
{
mappings.For<SARS.Directory>(binding => binding
.ItemDataBound((item, directory) =>
{
item.Text = (string)directory.DirectoryName;
item.Value = (string)directory.NodeID;
item.ImagUrl="~/Images/Folder-Add-icon.png";
})
//Sub Directories
.Children(directory => directory.Directory1));
mappings.For<SARS.Directory>(binding => binding
.ItemDataBound((item, dir) =>
{
item.Text = dir.DirectoryName;
item.Value = (string)dir.NodeID;
item.ImagUrl="~/Images/Folder-Add-icon.png";
})
//Sub archives
.Children(directory => directory.Archives));
mappings.For<SARS.Archive>(binding => binding
.ItemDataBound((item, arch) =>
{
item.Text = arch.ArchiveName;
}));
})
.Render();%>
編輯:問題是我沒有變檔案級別。 我該怎麼辦?
即1-行有分號,是否正確? – 2011-04-21 04:37:31
檢查更新。 – Lisa 2011-04-21 08:27:54