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

x
?
Solved

Accessing ASP.NET TreeView Node Attributes

Posted on 2008-11-03
4
Medium Priority
?
696 Views
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?

Thanks
0
Comment
Question by:deeisner
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

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

Author Comment

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

Accepted Solution

by:
Juan_Barrera earned 1000 total points
ID: 22871978
Arrghhh...right!

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

 

0
 

Author Closing Comment

by:deeisner
ID: 31512857
Great idea, thank you.
0

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