Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Accessing ASP.NET TreeView Node Attributes

Posted on 2008-11-03
Medium Priority
Last Modified: 2012-05-05
Does anyone know if there is a way to access the innerHTML or innerText properties of a TreeNode object?

There are only a few methods accessible for the Nodes of a TreeViewNodes object collection including Text, NavigateURL, ImageURL and Target. But I am wanting to add a custom attribute to the Node (not TreeView) level such as "rel=nofollow" to the Node's <a> tag.

There seems to be no way to do this on the Server side.

Does anyone have a solution that might work on either the Server or Client script side?

Question by:deeisner
  • 2
  • 2
LVL 20

Expert Comment

ID: 22871575
I think that YourTreeView.Node(yourNode).Attributes.Add("rel","nofollow") should work.

Author Comment

ID: 22871760
no, there is no Attribute or Attributes property at the TreeNode level. Only for the container TreeView object. Thanks though
LVL 20

Accepted Solution

Juan_Barrera earned 1000 total points
ID: 22871978

Well, then you can create your own TreeNode, and use it instead of the default one.
Here is a good example: http://www.codeproject.com/KB/aspnet/CustomTreeView.aspx



Author Closing Comment

ID: 31512857
Great idea, thank you.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question