Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8871743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:03:58+00:00 2026-06-14T18:03:58+00:00

aspx file: <div> <asp:TreeView ID=TreeView1 runat=server DataSourceID=XmlDataSource1 ShowCheckBoxes=All ShowLines=True> </asp:TreeView> <asp:XmlDataSource ID=XmlDataSource1 runat=server DataFile=~/Details.xml>

  • 0

aspx file:

  <div>
    <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1" 
        ShowCheckBoxes="All" ShowLines="True">
    </asp:TreeView>
    <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Details.xml">
    </asp:XmlDataSource>
  </div>

Deatails.xml:

 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <Root>
 <Collection Name="Server 1">
  <Box>MB1</Box>
  <Box>MB2</Box>
  <Box>MB3</Box>
  <Box>MB4</Box>
  <Box>MB5</Box>
  </Collection>
 </Root>

Stack Trace:

 [XmlException: Root element is missing.]
 System.Xml.XmlTextReaderImpl.Throw(Exception e) +76
 System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res) +61
 System.Xml.XmlTextReaderImpl.ParseDocumentContent() +3981048
 System.Xml.XmlTextReaderImpl.Read() +151
 System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) +58
 System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +20
 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +129
 System.Xml.XmlDocument.Load(XmlReader reader) +108
 System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency) +306
 System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +153
 System.Web.UI.WebControls.XmlHierarchicalDataSourceView.Select() +17
 System.Web.UI.WebControls.TreeView.DataBindNode(TreeNode node) +125
 System.Web.UI.WebControls.TreeView.PerformDataBinding() +120
 System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +85
 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
 System.Web.UI.WebControls.TreeView.DataBind() +4
 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
 System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
 System.Web.UI.WebControls.TreeView.OnPreRender(EventArgs e) +36
 System.Web.UI.Control.PreRenderRecursiveInternal() +80
 System.Web.UI.Control.PreRenderRecursiveInternal() +171
 System.Web.UI.Control.PreRenderRecursiveInternal() +171
 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

While loading the page the exception is thrown, I tried to validate the xml file & its valid according to w3cshools validator. What things do cause this exception. Correct me where I went wrong. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:03:59+00:00Added an answer on June 14, 2026 at 6:03 pm

    Try changing your treeview code once like below

    <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1">
    <DataBindings>  
     <asp:TreeNodeBinding DataMember="Collection" TextField="Name" />  
      <asp:TreeNodeBinding DataMember="Box" TextField="Name" />  
    
     </DataBindings> 
    </asp:TreeView>
    

    XML

    <?xml version="1.0" encoding="utf-8" ?>  
     <Collection Name="Server 1">
      <Box Name="MB1"></Box>
      <Box Name="MB2"></Box>
      <Box Name="MB3"></Box>
      <Box Name="MB4"></Box>
     </Collection>
    

    TreeView Example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

aspx file: <asp:Repeater ID=Repeater_sorular runat=server> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <div class=div_soru> <div class=div_soru_wrapper> <%#Eval(Subject)%> <asp:RadioButtonList
How to access to Label5 from behind page file(default.aspx.cs)? <ItemTemplate> <asp:Image ID=Image1 runat=server />
i have this code in my default aspx file : <body> <form id=form1 runat=server>
In my TimeIn.aspx File, I am displaying clock with following code: <div> <div> <asp:ScriptManager
<div id=SideBar class=sidebar mainbar> I've just seen this in a .aspx file. Is this
The first snippet of my codes, which is in the file named sys_Param.aspx: <div
I have an .aspx file that outputs an image using the following methods: Server.MapPath(somefile.png)
With asp.net-4.0 I did this: slideshow.aspx <div class=wrapCarousel> <div class=Carousel> <% foreach(var image in
My code : Test.aspx file: <%@ Page Language=C# AutoEventWireup=true CodeFile=Test.aspx.cs Inherits=Test %> <!DOCTYPE html
i have a file explorer like below : <%@ Page Language=C# AutoEventWireup=true CodeBehind=SearchBar.aspx.cs Inherits=FileExplorer.SearchBar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.