Using the Treeview Webcontrol

Discussion in 'ASP .Net' started by Irishmaninusa, Jun 26, 2004.

  1. Hello,

    I am a newbie to asp.net and I am trying to do sample code using the
    treeview code, and for some reason it is not displaying the way I would
    expect it to display. HEre is the code in question

    <%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
    <%@ Register TagPrefix="IE"
    Namespace="Microsoft.Web.UI.WebControls"
    Assembly="Microsoft.Web.UI.WebControls" %>



    <script runat="server">
    sub TreeView_SelectedIndexChanged(s as object, e as TreeViewSelectEventArgs)
    lblSelectedNode.text = treeBooks.GetNodeFromIndex(e.NewNode).Text
    end sub
    </script>

    <html>
    <head><title>Test</title></head>
    <body>
    <form runat="Server">
    <IE:TreeView
    id="treeBooks"
    AutoPostBack="True"
    OnSelectedIndexChange="TreeView_SelectedIndexChanged"
    Runat="Server">
    <TreeNode Text="Home" >
    <TreeNode
    Text="test" />
    <TreeNode
    Text="test2" />
    </TreeNode>
    </IE:TreeView>
    <asp:label id="lblSelectedNode" Runat="server" />
    </form>
    </body>
    </html>

    I was expecting a tree view to display a node of Home and then subnodes test
    and test2, but it doesn't do that, it just displays the items on the screen.
    Thanks in advance for any help that is given on this.
    Irishmaninusa, Jun 26, 2004
    #1
    1. Advertising

  2. figured it out.

    "Irishmaninusa"
    <> wrote in
    message news:...
    > Hello,
    >
    > I am a newbie to asp.net and I am trying to do sample code using the
    > treeview code, and for some reason it is not displaying the way I would
    > expect it to display. HEre is the code in question
    >
    > <%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
    > <%@ Register TagPrefix="IE"
    > Namespace="Microsoft.Web.UI.WebControls"
    > Assembly="Microsoft.Web.UI.WebControls" %>
    >
    >
    >
    > <script runat="server">
    > sub TreeView_SelectedIndexChanged(s as object, e as

    TreeViewSelectEventArgs)
    > lblSelectedNode.text = treeBooks.GetNodeFromIndex(e.NewNode).Text
    > end sub
    > </script>
    >
    > <html>
    > <head><title>Test</title></head>
    > <body>
    > <form runat="Server">
    > <IE:TreeView
    > id="treeBooks"
    > AutoPostBack="True"
    > OnSelectedIndexChange="TreeView_SelectedIndexChanged"
    > Runat="Server">
    > <TreeNode Text="Home" >
    > <TreeNode
    > Text="test" />
    > <TreeNode
    > Text="test2" />
    > </TreeNode>
    > </IE:TreeView>
    > <asp:label id="lblSelectedNode" Runat="server" />
    > </form>
    > </body>
    > </html>
    >
    > I was expecting a tree view to display a node of Home and then subnodes

    test
    > and test2, but it doesn't do that, it just displays the items on the

    screen.
    > Thanks in advance for any help that is given on this.
    >
    >
    >
    >
    Irishmaninusa, Jul 16, 2004
    #2
    1. Advertising

  3. Hi,

    MS TreeView Control is not working properly - as far as I have tested please
    try with modified controls.

    http://www.aspheute.com/artikel/20020801.htm

    get back to me if not getting correctly,

    Harsh
    "Irishmaninusa"
    <> wrote in
    message news:...
    > Hello,
    >
    > I am a newbie to asp.net and I am trying to do sample code using the
    > treeview code, and for some reason it is not displaying the way I would
    > expect it to display. HEre is the code in question
    >
    > <%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
    > <%@ Register TagPrefix="IE"
    > Namespace="Microsoft.Web.UI.WebControls"
    > Assembly="Microsoft.Web.UI.WebControls" %>
    >
    >
    >
    > <script runat="server">
    > sub TreeView_SelectedIndexChanged(s as object, e as

    TreeViewSelectEventArgs)
    > lblSelectedNode.text = treeBooks.GetNodeFromIndex(e.NewNode).Text
    > end sub
    > </script>
    >
    > <html>
    > <head><title>Test</title></head>
    > <body>
    > <form runat="Server">
    > <IE:TreeView
    > id="treeBooks"
    > AutoPostBack="True"
    > OnSelectedIndexChange="TreeView_SelectedIndexChanged"
    > Runat="Server">
    > <TreeNode Text="Home" >
    > <TreeNode
    > Text="test" />
    > <TreeNode
    > Text="test2" />
    > </TreeNode>
    > </IE:TreeView>
    > <asp:label id="lblSelectedNode" Runat="server" />
    > </form>
    > </body>
    > </html>
    >
    > I was expecting a tree view to display a node of Home and then subnodes

    test
    > and test2, but it doesn't do that, it just displays the items on the

    screen.
    > Thanks in advance for any help that is given on this.
    >
    >
    >
    >
    Harshdeep Mehta, Aug 11, 2004
    #3
    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. Guest
    Replies:
    2
    Views:
    729
  2. Luis Ramírez.

    Can a webcontrol (webcontrol.dll) have a configuration file?

    Luis Ramírez., Jul 5, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    195
    Luis Ramírez
    Jul 6, 2004
  3. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    183
    Kasabaarde Sumta
    Dec 13, 2004
  4. Fabricio

    Custom webcontrol that references another webcontrol

    Fabricio, Sep 21, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    176
    Fabricio
    Sep 21, 2005
  5. Peter Morris [Air Software Ltd]

    WebControl with non-WebControl property

    Peter Morris [Air Software Ltd], Dec 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    131
    Peter Morris [Air Software Ltd]
    Dec 7, 2004
Loading...

Share This Page