Problem with TreeView

liunx

Guest
I have a treeview control that I have added to my MasterPage on the left side of the page. Within VS2005b2 I have no problem configuring the control or seeing it while in VS2005. When I do the build I get no errors.

The problem I am encountering is once the page attempts to render in teh browser I get the following error:
A control with ID 'XmlDataSource1' could not be found.

Does anyone know why I am getting this message and or how to fix it?

I was using a great article referenced within the "code-magazine" website and makes no mention of needing to write any additional code in order to get the control to populate. As stated above, I have no problem viewing the contents of the control in VS2005. It is reading my xml file just fine.

Any thoughts greatly appreciated.

Sincerely,

Mustang,Thought I would post some code for review.

I have a datasource:
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/nav.xml"></asp:XmlDataSource>

Here is how I have the Treeview setup:
<asp:TreeView ID="TreeView1"
runat="server"
DataSourceID="XmlDataSource1"
ShowLines="True"
AutoGenerateDataBindings="False"
>
<DataBindings>
<asp:TreeNodeBinding DataMember="Menus" Text="Help Topics" />
<asp:TreeNodeBinding DataMember="Menu" TextField="Text" />
<asp:TreeNodeBinding DataMember="SubMenu" TextField="Text" />
</DataBindings>
</asp:TreeView>

Here is the nav.xml file I use to populate the TreeView:
<?xml version="1.0" encoding="utf-8" ?>
<Menus>
<Menu Text="Browsing the Web Offline">
<SubMenu Text="Making Web Pages Available Offline" />
<SubMenu Text="Viewing Web Pages without being Connected" />
</Menu>
<Menu Text="Printing and Saving Information">
<SubMenu Text="Printing and Saving Information" />
<SubMenu Text="Saving a Web Page on Your Computer" />
<SubMenu Text="Saving Text from a Web page" />
</Menu>
</Menus>

My thought was that I need to specify the XmlDataSource1 as the DataSourceID however, for grins and giggles I changed it to "nav.xml". This did not work however.

Can you see anything else that might be contributing to the problem.

Thanks again.Although it hurts :( to admint this my problem was lack of attention to detail. The resolution to the problem was evident within the Master page. Apparently, my form tags did not span content place holder where my TreeView existed. Once I moved the </form> tag to the bottom of the Table all was fine.

Mustang.
 
Back
Top