asp.net 2.0 treeview control expand with select

Discussion in 'ASP .Net' started by Stephen, Aug 3, 2005.

  1. Stephen

    Stephen Guest

    In asp.net 1.1, the IE treeview web control has a property called
    "SelectExpands" that, when set to true, expands a node when a user
    clicks the node text. I can't seem to replicate this in the treeview
    control in .net 2.0. Anyone know of way to expand a node when a users
    clicks the node text?
     
    Stephen, Aug 3, 2005
    #1
    1. Advertising

  2. Hi Stephen,

    you can use TreeView1.ExpandAll() to expand the entire tree view control on
    the click on root item. and analogous to it, you can also collapse using
    CollapseAll() method. Howver, this will expand or collapse all.

    You can as well expand single node some where down the line.

    "Stephen" wrote:

    > In asp.net 1.1, the IE treeview web control has a property called
    > "SelectExpands" that, when set to true, expands a node when a user
    > clicks the node text. I can't seem to replicate this in the treeview
    > control in .net 2.0. Anyone know of way to expand a node when a users
    > clicks the node text?
    >
    >
     
    =?Utf-8?B?d2hpZGJleV9ib3k=?=, Aug 19, 2005
    #2
    1. Advertising

  3. Stephen

    Stephen Guest

    Found this finally. you have to do a databinding, and within that
    there is a SelectAction property. This needs to be ste to SelectExpand
    or Expand. Expand only expands or contracts the node, which is what I
    want. here is a sample of the treeview control:

    <asp:TreeView ID="TreeView2" Runat="server" Width="21%"
    Height="100%"
    Font-Size="10pt" DataSourceID="SiteMapDataSource1"
    ForeColor="Black" ExpandDepth="0"
    BorderStyle="None" BackColor="Transparent"
    Font-Names="Tahoma;verdana;arial"
    NodeIndent="15" AutoGenerateDataBindings="False">
    <LeafNodeStyle ForeColor="Black"></LeafNodeStyle>
    <HoverNodeStyle Font-Bold="False" ForeColor="#6666AA"
    Font-Underline="True"></HoverNodeStyle>
    <SelectedNodeStyle Font-Underline="False"
    HorizontalPadding="0px"
    VerticalPadding="0px" />
    <NodeStyle Font-Names="Tahoma" Font-Size="8pt"
    ForeColor="Black" HorizontalPadding="2px"
    NodeSpacing="0px" VerticalPadding="2px" />
    <ParentNodeStyle ForeColor="Blue" />
    <RootNodeStyle ForeColor="Blue" />
    <DataBindings>
    <asp:TreeNodeBinding DataMember="SiteMapNode"
    NavigateUrlField="Url" SelectAction="Expand" TextField="Title" />
    </DataBindings>
    </asp:TreeView>

    Works perfectly...

    Stephen wrote:
    > In asp.net 1.1, the IE treeview web control has a property called
    > "SelectExpands" that, when set to true, expands a node when a user
    > clicks the node text. I can't seem to replicate this in the treeview
    > control in .net 2.0. Anyone know of way to expand a node when a users
    > clicks the node text?
     
    Stephen, Aug 24, 2005
    #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. Karim El Jed
    Replies:
    4
    Views:
    12,952
    Karim El Jed
    Oct 7, 2005
  2. vivek
    Replies:
    2
    Views:
    6,299
    pushp
    Jun 14, 2007
  3. Anders
    Replies:
    0
    Views:
    897
    Anders
    Apr 27, 2006
  4. sekhar2cool
    Replies:
    0
    Views:
    787
    sekhar2cool
    Apr 14, 2008
  5. Karim El Jed

    Expand TreeView programmatically (ASP.NET 2.0)

    Karim El Jed, Oct 6, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    426
    Karim El Jed
    Oct 6, 2005
Loading...

Share This Page