user1514138
user1514138

Reputation: 39

treeview with menu

I want to create a treeview but my problem is i dont know if is it possible to have hyperlinks in a treeview, when you click a node you see those hyperlinks that can redirect you to another form?. treeview is binded to the database

Upvotes: 1

Views: 1247

Answers (2)

Akash KC
Akash KC

Reputation: 16310

You can set NavigateUrl property of TreeNode which gets or sets the URL to navigate to when the node is clicked.

You can implement NavigateUrl in following way:

  <asp:TreeView id="SampleTreeView" 
        runat="server">
        <Nodes>
          <asp:TreeNode Value="Home" 
            NavigateUrl="Home.aspx" 
            Text="Home"
            Target="Content" 
            Expanded="True">
            <asp:TreeNode Value="Page 1" 
              NavigateUrl="Page1.aspx" 
              Text="Page1"
              Target="Content">
              <asp:TreeNode Value="Section 1" 
                NavigateUrl="Section1.aspx" 
                Text="Section 1"
                Target="Content"/>
            </asp:TreeNode>              
            <asp:TreeNode Value="Page 2" 
              NavigateUrl="Page2.aspx"
              Text="Page 2"
              Target="Content">
            </asp:TreeNode> 
          </asp:TreeNode>
        </Nodes>
      </asp:TreeView>

Upvotes: 1

yogi
yogi

Reputation: 19601

Try this NavigateUrl property of TreeNode

<asp:TreeView runat="server" ID="tree">
     <Nodes>
         <asp:TreeNode NavigateUrl="~/Default.aspx" Text="Go to default"/>
     </Nodes>
</asp:TreeView>

Upvotes: 1

Related Questions