日期:2014-05-19  浏览次数:20551 次

200分问几个简单问题,帮顶有分!
1,请问可不可以直接从得到如:c:\盘下面文件夹的树!(意思是把文件夹绑定到树上面)!如果不行就只能郁闷了!
2,vb.net怎么用xml绑定treeview,有点简单代码帖出来最好!谢谢!
3.绑定之后怎样添加,删除,重命名操作!
谢谢各位指点!

------解决方案--------------------
UP
------解决方案--------------------
先up再看
------解决方案--------------------
坐着看
------解决方案--------------------
1.可以. 用System.IO.DirectoryInfo就可以实现. 2. 不用代码都可 <asp:TreeView ID= "TreeView1 " runat= "server " DataSourceID= "XmlDataSource1 " OnTreeNodeDataBound= "TreeView1_TreeNodeDataBound "> </asp:TreeView> <asp:XmlDataSource ID= "XmlDataSource1 " runat= "server " DataFile= "treeview.xml "> </asp:XmlDataSource> 3.删除xml还是treeview?
------解决方案--------------------
到51aspx找找看吧!祝你好运!
------解决方案--------------------
找现成的控件。
------解决方案--------------------
up
------解决方案--------------------
shelltreeview
------解决方案--------------------
1)当然可直接从得到如:c:\盘下面文件夹的树,不过不明白楼主说的文件夹绑定到树上面是啥意思
2)vb.net不会用
3)绑定之后要想添加,删除,重命名操作,必段先对文件或文件夹进行添加,删除,重命名的操作,然后再次绑定.
------解决方案--------------------
.aspx:
<iewc:TreeView ID= "tree " runat= "server "> </iewc:TreeView>

.vb:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
tree.SelectExpands = True
tree.ExpandLevel = 3
tree.TreeNodeSrc = Server.MapPath( "../../XML/source.xml ")
tree.DataBind
End If
End Sub

.xml:
<?xml version= "1.0 " encoding= "utf-8 "?>
<TREENODES>
<TREENODE TEXT= "技术分析 " >
<TREENODE TEXT= "切线分析 " navigateurl= "xx.aspx?NodeText=切线分析 " Target= "mainFrame " ImageUrl= "images/book.gif " />
<TREENODE TEXT= "周期分析 " navigateurl= "xx.aspx?NodeText=周期分析 " Target= "mainFrame " ImageUrl= "images/book.gif " />
<TREENODE TEXT= "指标分析 " navigateurl= " " Target= "mainFrame " ImageUrl= "images/book.gif " />
</TREENODE>
<TREENODE TEXT= "基本分析 " ChildType= "Link " ImageUrl= "images/closedfolder.gif " >
<TREENODE TEXT= "政策分析 " navigateurl= " " ImageUrl= "images/book.gif "/>
<TREENODE TEXT= "题材分析 " navigateurl= " " ImageUrl= "images/book.gif "/>
</TREENODE>
</TREENODES>
------解决方案--------------------
这里正好有一段现成的代码
void Treeview1_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
if (IsCallback)
if (e.Node.ChildNodes.Count == 0)
{
LoadChildNode(e.Node);
}

}

private void LoadChildNode(TreeNode node)
{

DirectoryInfo directory;
directory = new DirectoryInfo(node.Value);