Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using string as datasource of TreeNodeSrc on TreeView

Thread Tools

Using string as datasource of TreeNodeSrc on TreeView
Posts: n/a

I'm having a problem with a tree view. The data source for this an XML
string set using the TreeView.TreeNodeSrc property in the code behind
page. The XML is generated by a stored procedure and is as follows
(there are no line breaks in the original - I've added these for
<TreeNode NodeData="1" CheckBox="true" Checked="false"
<TreeNode NodeData="93" CheckBox="true" Checked="false"
Text="Community and living"/>
<TreeNode NodeData="204" CheckBox="true" Checked="false"
Text="Education and learning"/>

I store this XML in a string (strMyXML) and then set the TreeNodeSrc
property in my code as follows:
TreeView1.Nodes[0].TreeNodeSrc = strMyXML;

Usually this runs with no problems, but sometimes the page brings back
an error of the famous "The XML loaded from TreeNodeSrc=<[my XML
here]>, TreeNodeXslSrc= did not contain the required outer <TREENODES>"
variety. On looking through the IIS logs for this, I've discovered
that on these occasions, although I am still passing a string
containing XML to the TreeNodeSrc property, it is incorrectly assuming
that I am passing it a URL, and as a consequence is searching for a
page using my XML as the URL (eg, http://mydomain/<TREENODES><TreeNode
NodeData="1" CheckBox="true" Checked="false"

Is there any way I can force the treeview to recognise that I am
passing it some XML to parse and not a URL? Or is there something in
my XML file that might cause the TreeNodeSrc property to parse it

Thanks very much for any help!

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
Treeview.TreeNodeSrc = "xml formated string" does url-request ThoGen ASP .Net Web Controls 0 04-21-2006 09:14 AM
How to enter a variable in the treenodesrc of a treenode =?Utf-8?B?bWFya2FlbGtpbnNAbmV3c2dyb3Vwcy5ub3NwYW0=?= ASP .Net 3 09-19-2005 01:38 AM
TreeView Control - Basic Question with TreeNodeSrc Dennis Redfield ASP .Net Web Controls 8 02-25-2005 01:11 AM
How to bind an xml string to TreeNodeSrc Donal ASP .Net Web Controls 0 03-06-2004 07:39 PM
Does treeview works in .NET framework 1.1 using TreeNodeSrc to bind an XML file. Thomas ASP .Net Web Controls 1 10-16-2003 06:45 PM