Accessing ASP.NET TreeView Node Attributes

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?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think that YourTreeView.Node(yourNode).Attributes.Add("rel","nofollow") should work.
deeisnerAuthor Commented:
no, there is no Attribute or Attributes property at the TreeNode level. Only for the container TreeView object. Thanks though

Well, then you can create your own TreeNode, and use it instead of the default one.
Here is a good example:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
deeisnerAuthor Commented:
Great idea, thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.