Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > WebControls TreeView Error

Thread Tools

WebControls TreeView Error

David Elliott
Posts: n/a
I am trying to use the TreeView Control that is part of the WebControls
package from Microsoft.

I was getting this error:
Exception Details: System.Xml.XmlException: The data at the
root level is invalid. Line 1, position 1.

I then set the permission for the file and then started getting:
Exception Details: System.Exception: The XML loaded from
TreeNodeSrc=state_city.xml, TreeNodeXslSrc= did not contain
the required outer <TREENODES> container.

The XML file clearly has it. If I cut and paste the XML file into the
the Page_Load and bind it to the control as a string, this works
jsut fine.

Any help would be appreciated.



public class WebForm1 : System.Web.UI.Page
protected Microsoft.Web.UI.WebControls.TreeView MyTreeView;

private void Page_Load(object sender, System.EventArgs e)
MyTreeView.TreeNodeTypeSrc = @"state_city.xml";

<?xml version="1.0" ?>
<treenode Text="Michigan">
<treenode Text="Detroit" />
<treenode Text="Farmington" />
<treenode Text="Southfield" />
<treenode Text="Washington">
<treenode Text="Bellevue" />
<treenode Text="Redmond" />
<treenode Text="Woodinville" />
Reply With Quote
Posts: n/a

// -- Try this

TreeNode nodeTop = new TreeNode();

nodeTop.Text = "My Root Node";
nodeTop.ExpandedImageUrl = "/webctrl_client/1_0/images/root.gif" ;


Treeview1.Nodes[0].Expanded = true;

olevchuk's Profile:
View this thread:

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Object reference not set to an instance of an object. System.Web.UI.WebControls.ListItemCollection.SaveViewState() System.Web.UI.WebControls.ListControl.SaveViewState() Brano ASP .Net 3 11-08-2005 12:29 PM
Specified cast is not valid (TreeView IE WebControls) Sabri Ammar ASP .Net 1 02-14-2005 02:08 AM
Events in TreeView WebControls Client Behavior =?Utf-8?B?TWF5a2VsIE1hcnTDrW5leg==?= ASP .Net 0 03-05-2004 11:01 PM
IE TreeView WebControls lockup / freeze solution Mike Szanto ASP .Net 0 08-28-2003 02:44 PM
IE Webcontrols, different images for TreeView Jurjen de Groot ASP .Net 2 07-09-2003 08:07 AM