473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Treeview and XML

I am trying to implement a Treeview w/an XML file and I even copied and
pasted examples from MSDN but can't get them to work. Any suggestions
welcome.

XML File

<TREENODES>
<TREENODE TEXT="Document-1">
<TREENODE TEXT="Folder-1" EXPANDED="true">
<TREENODE TEXT="Document-2" />
<TREENODE TEXT="Document-3" />
</TREENODE>
<TREENODE TEXT="Document-4">
</TREENODES>
Control Source

<iewc:TreeView id="TreeView1" style="Z-INDEX: 102; LEFT: 168px;
POSITION: absolute; TOP: 120px" runat="server"
TREENODESRC="NavigateTree.xml"></iewc:TreeView>

Error

Server Error in '/Manager' Application.
------------------------------------------------------------------------
--------

The data at the root level is invalid. Line 1, position 1.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: The data at the root level
is invalid. Line 1, position 1.


Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
14 6776
Cor
Evan,
Will you help me, I want to use a Treeview on a webpage. I saw it with aspx
and scripting but not with VB.net, can you tell me where I can find this.
Cor
Nov 20 '05 #2
Hi Evan,

You may try to modified the XML file as follows.
<TREENODES>
<TREENODE TEXT="Document-1"/>
<TREENODE TEXT="Folder-1" EXPANDED="true">
<TREENODE TEXT="Document-2" />
<TREENODE TEXT="Document-3" />
</TREENODE>
<TREENODE TEXT="Document-4"/>
</TREENODES>
[Note: the node in xml file should end with /
e.g.
<TREENODE TEXT="Document-1"/>
and
<TREENODE TEXT="Folder-1" EXPANDED="true">
</TREENODE>
is correct syntax.
In addition the <TREENODE TEXT="Document-1"/> is the brief form of
<TREENODE TEXT="Document-1"></TREENODE>.

If you have further related question please feel free to contact me.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
From: Evan Kontos <ek*****@comtekcadd.com>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: Treeview and XML
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <eH**************@TK2MSFTNGP11.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
Date: Tue, 02 Sep 2003 08:39:09 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:133554
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I am trying to implement a Treeview w/an XML file and I even copied and
pasted examples from MSDN but can't get them to work. Any suggestions
welcome.

XML File

<TREENODES>
<TREENODE TEXT="Document-1">
<TREENODE TEXT="Folder-1" EXPANDED="true">
<TREENODE TEXT="Document-2" />
<TREENODE TEXT="Document-3" />
</TREENODE>
<TREENODE TEXT="Document-4">
</TREENODES>
Control Source

<iewc:TreeView id="TreeView1" style="Z-INDEX: 102; LEFT: 168px;
POSITION: absolute; TOP: 120px" runat="server"
TREENODESRC="NavigateTree.xml"></iewc:TreeView>

Error

Server Error in '/Manager' Application.
------------------------------------------------------------------------
--------

The data at the root level is invalid. Line 1, position 1.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: The data at the root level
is invalid. Line 1, position 1.


Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Nov 20 '05 #3
Peter,
Tried the change that you recommended but I still get the same error
message. This is also at the top of the XML file

<?xml version='1.0'?>

and the rest of the file:

<TREENODES>
<TREENODE TEXT="Document-1"/>
<TREENODE TEXT="Folder-1" EXPANDED="true">
<TREENODE TEXT="Document-2" />
<TREENODE TEXT="Document-3" />
</TREENODE>
<TREENODE TEXT="Document-4"/>
</TREENODES>
any more suggestions?

Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4
Hi Evan,

I can not reproduce the problem. Here is my test code. I tested on
VS.NET2003.
I hope you can create a new project and perform the test and let me know
the result.
1.Create a new Webapplication
2.Drag the TreeView control to the webform
3.Modified the NavigateTree.xml and yourapp.aspx as follows.
[NavigateTree.xml, please place it in the same directory as the one of
yourapp.aspx]
<?xml version='1.0'?>
<TREENODES>
<TREENODE TEXT="Document-1"/>
<TREENODE TEXT="Folder-1" EXPANDED="true">
<TREENODE TEXT="Document-2" />
<TREENODE TEXT="Document-3" />
</TREENODE>
<TREENODE TEXT="Document-4"/>
</TREENODES>

[yourapp.aspx]
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication3.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<iewc:treeview id="TreeView1" style="Z-INDEX: 101; LEFT: 8px; POSITION:
absolute; TOP: 8px" runat="server"
TREENODESRC="NavigateTree.xml"></iewc:treeview></FONT></form>
</body>
</HTML>

Please perform the test and let me know the result. This will help me
narrow down and isolate the problem.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
From: Evan Kontos <ek*****@comtekcadd.com>
References: <lc**************@cpmsftngxa06.phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: RE: Treeview and XML
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <ex**************@TK2MSFTNGP10.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
Date: Wed, 03 Sep 2003 05:54:36 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:133770
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Peter,
Tried the change that you recommended but I still get the same error
message. This is also at the top of the XML file

<?xml version='1.0'?>

and the rest of the file:

<TREENODES>
<TREENODE TEXT="Document-1"/>
<TREENODE TEXT="Folder-1" EXPANDED="true">
<TREENODE TEXT="Document-2" />
<TREENODE TEXT="Document-3" />
</TREENODE>
<TREENODE TEXT="Document-4"/>
</TREENODES>
any more suggestions?

Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 20 '05 #5
Peter,
Here is the error that I get. It seems the same. I click on the data
tab at the bottom of the XML page and I see a grid w/the values and it
looks OK. ANy ideas?

The data at the root level is invalid. Line 1, position 1.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: The data at the root level
is invalid. Line 1, position 1.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:
[XmlException: The data at the root level is invalid. Line 1, position
1.]
System.Xml.XmlTextReader.ParseRoot() +295
System.Xml.XmlTextReader.Read() +127
Microsoft.Web.UI.WebControls.TreeView.ReadXmlSrc(S tring TreeNodeSrc,
String TreeNodeXsltSrc, String strOuter) +136
Microsoft.Web.UI.WebControls.TreeView.ReadTreeNode XmlSrc() +80
Microsoft.Web.UI.WebControls.TreeView.OnInit(Event Args e) +90
System.Web.UI.Control.InitRecursive(Control namingContainer) +241
System.Web.UI.Control.InitRecursive(Control namingContainer) +179
System.Web.UI.Control.InitRecursive(Control namingContainer) +179
System.Web.UI.Page.ProcessRequestMain() +174


Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #6
Hi Evan,

You may try to set the TreeNodeSrc as following to see if this works for
you. [You may delete TREENODESRC="NavigateTree.xml" in the aspx page]
private void Page_Load(object sender, System.EventArgs e)
{
TreeView1.TreeNodeSrc="<?xml version=\"1.0\"?><TREENODES><TREENODE
TEXT=\"Document-1\"/><TREENODE TEXT=\"Folder-1\"
EXPANDED=\"true\"><TREENODE TEXT=\"Document-2\" /><TREENODE
TEXT=\"Document-3\" /></TREENODE><TREENODE
TEXT=\"Document-4\"/></TREENODES>";
TreeView1.DataBind();
}

If this works for you, you may need to see if the user you used to access
the aspx page have the right to access the NavigateTree.xml file. [If you
enable the anonymous access in the Directory Security/Anonymous access and
authentication control, then the user maybe IUSER_COMPUTERNAME.]
You may try to disable the anonymous access and enable the Integrated
Windows authentication.[Note, this will enable the browse to use the login
user account to access the aspx page and the NavigateTree.xml , make sure
the user have the according rights]

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: Evan Kontos <ek*****@comtekcadd.com>
References: <eu*************@cpmsftngxa06.phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: RE: Treeview and XML
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <ez**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
Date: Thu, 04 Sep 2003 09:47:44 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:134270
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Peter,
Here is the error that I get. It seems the same. I click on the data
tab at the bottom of the XML page and I see a grid w/the values and it
looks OK. ANy ideas?

The data at the root level is invalid. Line 1, position 1.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: The data at the root level
is invalid. Line 1, position 1.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:
[XmlException: The data at the root level is invalid. Line 1, position
1.]
System.Xml.XmlTextReader.ParseRoot() +295
System.Xml.XmlTextReader.Read() +127
Microsoft.Web.UI.WebControls.TreeView.ReadXmlSrc(S tring TreeNodeSrc,
String TreeNodeXsltSrc, String strOuter) +136
Microsoft.Web.UI.WebControls.TreeView.ReadTreeNode XmlSrc() +80
Microsoft.Web.UI.WebControls.TreeView.OnInit(Event Args e) +90
System.Web.UI.Control.InitRecursive(Control namingContainer) +241
System.Web.UI.Control.InitRecursive(Control namingContainer) +179
System.Web.UI.Control.InitRecursive(Control namingContainer) +179
System.Web.UI.Page.ProcessRequestMain() +174


Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 20 '05 #7
Peter,
What is it that you have sent me? I use VB and I have no idea what it
is you sent or where I should place it. Please advise in more detail if
you can. Thanks.
Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #8
Hi Evan,

I am sorry that I have not provided the VB.NET code for you in my last post.
I think the problem is caused by that the user account that used to access
the asp page do not have the permission to access the NavigateTree.xml file.
To workaround the problem, you have two methods.

1. The TreeView web control has a TreeNodeSrc property, you may set the
value to the xml file content in the Page_Load event. You may follow the
steps below to have a test.
1.1 Create a new WebApplication and add a TreeView Web Control onto the
WebForm1.aspx
1.2 Double-click on the WebForm1.aspx[not on any control]
1.3 Then the IDE will open the WebForm1.aspx.vb file and located in the
Page_Load Event handle function
1.4 Replace the
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
With
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TreeView1.TreeNodeSrc = "<?xml version='1.0'?><TREENODES><TREENODE
TEXT='Document-1'/><TREENODE TEXT='Folder-1' EXPANDED='true'><TREENODE
TEXT='Document-2' /><TREENODE TEXT='Document-3' /></TREENODE><TREENODE
TEXT='Document-4'/></TREENODES>"
TreeView1.DataBind()
End Sub
1.5 Press F5 to run the WebApplication to see if the problem persists.

2 You may also try to give the user account that used to access the
WebForm1.aspx the right to access the NavigateTree.xml. In this case you
may indicate the TREENODESRC in the aspx page.(i.e. <iewc:treeview
id="TreeView1" style="Z-INDEX: 101; LEFT: 8px; POSITION:
absolute; TOP: 8px" runat="server"
TREENODESRC="NavigateTree.xml"></iewc:treeview>)
For security concern, you may try to disable the anonymous access and
enable the windows integrated authentication. You may achieve that by
following the steps below.
2.1 Run inetmgr in the Run dialog and this will open the Internet
Information Services(IIS) Manager
2.2 Navigated to Internet Information Services/<Computer Name>/Web
Sites/Default Web Site/<WebApplication5>, (This is the application name
that you indicated in the VS.NET IDE),
2.3 Right Click on the WebApplication5 and select Properties, this will
open the WebApplication5 Properties dialog.
2.4 Select Directory security and then select Authentication and access
control section click the Edit button. This will open the Authentication
methods dialog
2.5 Uncheck the Enable anonymous access and check the Integrated Windows
authentication. This will enable the browse use the log on user account to
access the aspx page, I assume the account have the permission to access
the NavigateTree.xml file.
2.6 You may have a try and let me know the result. If you have any related
question please feel free to let me know.

Nov 20 '05 #9
Post Notify Successful

Nov 20 '05 #10
Peter,
Thanks for your reply. Your comment below:

Uncheck the Enable anonymous access and check the Integrated Windows
authentication.
Was already set this way. However I don;'t understand the next
sentence:

This will enable the browse use the log on user account to access the
aspx page, I assume the account have the permission to access the
NavigateTree.xml file.

If you can restate this line it would be helpful. Thanks.


Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #11
Peter,
Your first example works fine. If I replace the treenodesource line w/

TreeView1.TreeNodeSrc = "navigatetree.xml"

I get the error below. Could there be some problem w/the parser on my
machine w/regard to the XML?

Server Error in '/Treeview' Application.
------------------------------------------------------------------------
--------

The data at the root level is invalid. Line 1, position 1.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: The data at the root level
is invalid. Line 1, position 1.

Source Error:
Line 25: TreeView1.TreeNodeSrc = "navigatetree.xml"
Line 26: ' TreeView1.TreeNodeSrc = "<?xml
version='1.0'?><TREENODES><treenode text='document-1'/><treenode
TEXT='Folder-1' expanded='true'><treenode TEXT='Document-2' /><TREENODE
TEXT='Document-3' /></treenode><treenode
text='document-4'/></TREENODES>"
Line 27: TreeView1.DataBind()
Line 28: End Sub
Line 29:
Source File: e:\inetpub\wwwroot\Treeview\WebForm1.aspx.vb Line: 27

Stack Trace:
[XmlException: The data at the root level is invalid. Line 1, position
1.]
System.Xml.XmlTextReader.ParseRoot() +295
System.Xml.XmlTextReader.Read() +127
Microsoft.Web.UI.WebControls.TreeView.ReadXmlSrc(S tring TreeNodeSrc,
String TreeNodeXsltSrc, String strOuter) +134
Microsoft.Web.UI.WebControls.TreeView.ReadTreeNode XmlSrc() +80
Microsoft.Web.UI.WebControls.TreeView.DataBind()
Treeview.WebForm1.Page_Load(Object sender, EventArgs e) in
e:\inetpub\wwwroot\Treeview\WebForm1.aspx.vb:27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
It is beginning to sound like a problem w/.NET. Is there a way to get
this escalated as a system bug?

Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #12
Hi Evan,

Usually when you enable anonymous access, the Browser will use the
IUSER_XYZ account to access your web page.(here the computer name is XYZ)
When you disable the anonymous access and enable the Integrated Windows
authentication,i.e. Uncheck the Enable anonymous access and check the
Integrated Windows authentication.
In this case, if you log onto the computer using a account(e.g.
administrator), then the browser will use the administrator account to
access your web page. Hereby, you will have the enough permission to access
the web page as well as the navigatetree.xml.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: Evan Kontos <ek*****@comtekcadd.com>
References: <1d**************@cpmsftngxa06.phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: RE: Treeview and XML
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <Oy**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
Date: Sun, 07 Sep 2003 20:05:12 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:135356
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Peter,
Thanks for your reply. Your comment below:

Uncheck the Enable anonymous access and check the Integrated Windows
authentication.
Was already set this way. However I don;'t understand the next
sentence:

This will enable the browse use the log on user account to access the
aspx page, I assume the account have the permission to access the
NavigateTree.xml file.

If you can restate this line it would be helpful. Thanks.


Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 20 '05 #13
Hi Evan,

I can not reproduce the problem, and I did not find known issue about the
problem. In this case I hope you can have a check about two points.
1. Please check if the account you used the access the web page have the
permission to access the navigatetree.xml file. If you disable the
anonymous account and enable the windows integrated authenticatioin, you
will access the web page with the same account you log on to the
computer.(e.g. administrator)
2. Please check the path of the navigatetree.xml.
if you use the navigatetree.xml in such syntax.

TreeView1.TreeNodeSrc = "navigatetree.xml"

the navigatetree.xml should be placed under the same directory as where
WebForm1.aspx placed in.
e.g.
I access my test webapplication using
http://localhost/WebApplication5/WebForm1.aspx
the website lie in the C:\Inetpub\wwwroot\WebApplication5

Then the navigatetree.xml and WebForm1.aspx should be placed in the
C:\Inetpub\wwwroot\WebApplication5.

If you have any related question, please feel free to let me know.


Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: Evan Kontos <ek*****@comtekcadd.com>
References: <1d**************@cpmsftngxa06.phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: RE: Treeview and XML
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <uO*************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
Date: Sun, 07 Sep 2003 20:25:36 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:135359
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Peter,
Your first example works fine. If I replace the treenodesource line w/

TreeView1.TreeNodeSrc = "navigatetree.xml"

I get the error below. Could there be some problem w/the parser on my
machine w/regard to the XML?

Server Error in '/Treeview' Application.
------------------------------------------------------------------------
--------

The data at the root level is invalid. Line 1, position 1.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: The data at the root level
is invalid. Line 1, position 1.

Source Error:
Line 25: TreeView1.TreeNodeSrc = "navigatetree.xml"
Line 26: ' TreeView1.TreeNodeSrc = "<?xml
version='1.0'?><TREENODES><treenode text='document-1'/><treenode
TEXT='Folder-1' expanded='true'><treenode TEXT='Document-2' /><TREENODE
TEXT='Document-3' /></treenode><treenode
text='document-4'/></TREENODES>"
Line 27: TreeView1.DataBind()
Line 28: End Sub
Line 29:
Source File: e:\inetpub\wwwroot\Treeview\WebForm1.aspx.vb Line: 27

Stack Trace:
[XmlException: The data at the root level is invalid. Line 1, position
1.]
System.Xml.XmlTextReader.ParseRoot() +295
System.Xml.XmlTextReader.Read() +127
Microsoft.Web.UI.WebControls.TreeView.ReadXmlSrc(S tring TreeNodeSrc,
String TreeNodeXsltSrc, String strOuter) +134
Microsoft.Web.UI.WebControls.TreeView.ReadTreeNode XmlSrc() +80
Microsoft.Web.UI.WebControls.TreeView.DataBind()
Treeview.WebForm1.Page_Load(Object sender, EventArgs e) in
e:\inetpub\wwwroot\Treeview\WebForm1.aspx.vb:27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
It is beginning to sound like a problem w/.NET. Is there a way to get
this escalated as a system bug?

Evan Kontos | EK*****@comtekcadd.com

27 Whitehall St. | 3rd Floor | New York, NY 10004
Tel 212.480.8166 | Fax 212.480.8167 | Personal Fax 786.513.0295
www.comtekcadd.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 20 '05 #14
Hi Evan,

If you post a zip of your project source, I can see whether it causes the
error on my machine.

Regards,
Fergus
Nov 20 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
5
by: SoKool | last post by:
Can anyone point me to a site where I can get a free treeview control to use in ASP .NET or any tutorial that can help me build my own treeview control. I intend to use a treeview to generate a...
1
by: paradox | last post by:
I want to have a TreeView that shows an image on some items, but not all. Basically, if a certain condition is true, a caution icon is placed next to the treeview item. The problem is that, by...
3
by: Peter | last post by:
Hello, We are inserting a side menu to our application using a class that is writing HTML on all our pages. This is a part of the code as an example: writer.Write(" <table WIDTH=""100%""...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
14
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
3
by: christof | last post by:
I've got a really easy problem, please help me: There are two pages in one I'm creating a TreeView like that: TreeView dbTree = new TreeView(); TreeNode dbTreeRoot = new TreeNode("Root");...
2
by: Tymbow | last post by:
I'm building a web application that is analogous to the Windows XP file explorer in function. The left column contains a TreeView, and the right column a DataGrid populated by selecting TreeView...
1
by: kvicky | last post by:
I am trying to load child nodes to a TreeNode in a TreeView in a ASP.net web application. The Treeview with parent nodes are loaded on a Page_load while doing if( ! ISPostback ) and then in the...
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.