Using string as datasource of TreeNodeSrc on TreeView

C

claireCSHARPuser

Hi

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
readability):
<TREENODES>
<TreeNode NodeData="1" CheckBox="true" Checked="false"
Text="Business"/>
<TreeNode NodeData="93" CheckBox="true" Checked="false"
Text="Community and living"/>
<TreeNode NodeData="204" CheckBox="true" Checked="false"
Text="Education and learning"/>
<TREENODES>

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"
Text="Business"/></TREENODES>).

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
incorrectly?

Thanks very much for any help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top