Populate on demand a TreeView with datas in an XML

Posted by m6a-uds on Stack Overflow See other posts from Stack Overflow or by m6a-uds
Published on 2010-02-25T21:20:41Z Indexed on 2010/05/09 5:48 UTC
Read the original article Hit count: 196

Filed under:
|
|

Hi

I have a large XML file (3000+ nodes) that I want to represent in a TreeView on ASP.NET. I cannot databind it to a XMLDataSource because loading the TreeView will then be way too slow (I never even waited long enough to see it finish...)

So the solution for this would be to use the PopulateOnDemand property of the TreeNodes to load data only when needed. Problem is, I can't think of a way to acheive this...

How can-I, based on the ID of a node, search a XMLDocument to get all the childnodes of the node having this ID?

XML would look like that:

<document ID=1>
    <document ID=2>
        <document ID=3>
        </document>
    </document>
    <document ID=4>
    </document>
</document>

There are nor rules on how much levels it can go down or anything...

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about treeview