Archive for June, 2008

Hide Root Node of XML Bound TreeView (ASP.NET)

June 28, 2008



Please visit instead

You have a treeview with an XML file as a data source, but XML files by default must have a single root element, which shows up on your treeview. A lot of us don’t want it to show up, and there’s no obvious way to hide it. After an hour or so of searching for a solution, I found it here. This solution really needs to be more visible on the web!

Basically you just need to set the XMLDataSource XPath property as XPath = “/*/*”. I’m not entirely sure what this means, but you can read up more about it here.