Click node text to expand/collapse instead of +/- icon in asp.net treeview

Advertisements
 On a treeview, we can collapse and expand the nodes by clicking the +/- icon. I want to be able to click
the node text to achieve the same results.

We can achieved by using node Id's dynamically and setting the selection node Expand statically.

For Dynamic Treeview, we can implement select action by using node id's.

Example:

   TreeNode.SelectAction = TreeNodeSelectAction.Expand;
 
   Listnode.SelectAction = TreeNodeSelectAction.Expand;


 For static Treeview, We can easily achieved by setting the "selectaction="Expand"" to the Treenode

Example:

<asp:TreeView ID="TVID" runat="server">

  <Nodes>

    <asp:TreeNode Text="Content" SelectAction="Expand">

        <asp:TreeNode Text="Main" SelectAction="Expand">
        
          <asp:TreeNode Text="SharePoint" SelectAction="Expand">
              <asp:TreeNode Text="SharePoint2013"/>
              <asp:TreeNode Text="SharePoint2010"/>
              <asp:TreeNode Text="SharePoint2007"/>
           </asp:TreeNode>

          <asp:TreeNode Text=".Net" SelectAction="Expand">
              <asp:TreeNode Text="4.0"/>
              <asp:TreeNode Text="3.5"/>
              <asp:TreeNode Text="3.0"/>
           </asp:TreeNode>

        </asp:TreeNode>

   </asp:TreeNode>

  </Nodes>

</asp:TreeNode>


By using JavaScript

http://geekswithblogs.net/rajiv/archive/2006/03/16/72575.aspx


SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM
Advertisements
SHARE

lakshmitulasi Jasti

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment