WebControls TreeView Error

Discussion in 'ASP .Net' started by David Elliott, Mar 5, 2004.

  1. 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.

    Dave

    ===================

    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";
    MyTreeView.DataBind();
    }
    }


    <?xml version="1.0" ?>
    <TREENODES>
    <treenode Text="Michigan">
    <treenode Text="Detroit" />
    <treenode Text="Farmington" />
    <treenode Text="Southfield" />
    </treenode>
    <treenode Text="Washington">
    <treenode Text="Bellevue" />
    <treenode Text="Redmond" />
    <treenode Text="Woodinville" />
    </treenode>
    </TREENODES>
    David Elliott, Mar 5, 2004
    #1
    1. Advertising

  2. David Elliott

    olevchuk Guest

    // -- Try this

    TreeNode nodeTop = new TreeNode();

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

    Treeview1.Nodes.Add(nodeTop);

    Treeview1.Nodes[0].Expanded = true;
    Treeview1.Nodes[0].TreeNodeSrc
    Server.MapPath("./state_city.xml");
    Treeview1.Nodes[0].Databind()

    --
    olevchu
    -----------------------------------------------------------------------
    olevchuk's Profile: http://www.highdots.com/forums/m103
    View this thread: http://www.highdots.com/forums/t64623
    olevchuk, Oct 13, 2005
    #2
    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. Jurjen de Groot

    IE Webcontrols, different images for TreeView

    Jurjen de Groot, Jul 8, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    332
    Yan-Hong Huang[MSFT]
    Jul 9, 2003
  2. Mike Szanto
    Replies:
    0
    Views:
    354
    Mike Szanto
    Aug 28, 2003
  3. =?Utf-8?B?TWF5a2VsIE1hcnTDrW5leg==?=

    Events in TreeView WebControls Client Behavior

    =?Utf-8?B?TWF5a2VsIE1hcnTDrW5leg==?=, Mar 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    335
    =?Utf-8?B?TWF5a2VsIE1hcnTDrW5leg==?=
    Mar 5, 2004
  4. Sabri Ammar
    Replies:
    1
    Views:
    416
    Scott Allen
    Feb 14, 2005
  5. =?Utf-8?B?ZGF2aWQ=?=

    Microsoft TreeView: Microsoft.Web.UI.WebControls.dll

    =?Utf-8?B?ZGF2aWQ=?=, Apr 11, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    3,581
    Patrick Olurotimi Ige
    Apr 11, 2005
Loading...

Share This Page