Using string as datasource of TreeNodeSrc on TreeView

Discussion in 'ASP .Net' started by claireCSHARPuser@hotmail.co.uk, Jun 30, 2005.

  1. Guest

    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!
    , Jun 30, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWFya2FlbGtpbnNAbmV3c2dyb3Vwcy5ub3NwYW0=

    How to enter a variable in the treenodesrc of a treenode

    =?Utf-8?B?bWFya2FlbGtpbnNAbmV3c2dyb3Vwcy5ub3NwYW0=, Sep 15, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,060
    Steven Cheng[MSFT]
    Sep 19, 2005
  2. Thomas
    Replies:
    1
    Views:
    222
    Rajesh.V
    Oct 16, 2003
  3. Donal

    How to bind an xml string to TreeNodeSrc

    Donal, Mar 6, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    105
    Donal
    Mar 6, 2004
  4. Dennis Redfield

    TreeView Control - Basic Question with TreeNodeSrc

    Dennis Redfield, Feb 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    8
    Views:
    149
    Steven Cheng[MSFT]
    Feb 25, 2005
  5. ThoGen
    Replies:
    0
    Views:
    112
    ThoGen
    Apr 21, 2006
Loading...

Share This Page