|
-
July 1st, 2009, 01:14 AM
#1
TreeView control - dynamically bind to XmlDocument, not xml file?
hello
Reading this article on TreeView control...[^], it shows how to either bind a xml file on disk to TreeView control via "XmlDataSource"
Code:
<div>
<asp:TreeViewExpandImageUrl="Images/closed.gif"
CollapseImageUrl="Images/open.gif"ID="TreeView1"
Runat="server"DataSourceID="XmlDataSource1">
<DataBindings>
<asp:TreeNodeBindingDataMember="Category"
ValueField="ID"TextField="Name">
</asp:TreeNodeBinding>
<asp:TreeNodeBindingDataMember="Description"
ValueField="Value"
TextField="Value">
</asp:TreeNodeBinding>
</DataBindings>
</asp:TreeView>
</div>
<div>
<asp:XmlDataSourceID="XmlDataSource1"Runat="server"
DataFile="~/Data/Categories.xml">
</asp:XmlDataSource>
</div>
My question are:
1. how can we bind an in-memory (not on disk) XmlDocument object to a XmlDataSource? and thus TreeView control? In the article author has suggested an alternative - OnTreeNodePopulate event - however, this is not suitable for my case as my whole list/hierarchy is loaded in one go, not once-per-node.
2. how can we set navigation Url? in standard "web.sitemap", you can do this with siteMapNode's "Url" attribute. But now that, as in above example, uses my own custom Xml... how do we do this?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|