VS.NET - ASP.NET -ToolTip per node in ASP.NET Treeview control
Synopsis:
Microsoft's Treeview Webcontrol does not have a tooltip which works on a per node level. Here are two solutions to the problem.
Solution:
The first and easiest method is to put an <acronym> tag around the text in any node for which you want a tooltip:
Replace:
With this replacement the nodedata will be displayed a the tooltip.
Me.TreeView1.Nodes(0).Text = "<acronym title=""This is the tooltip"">" & _ "This is the node text</acronym>"Another method is to modify the htc file for the treeview control which should be located in a webctrl_client folder under the wwwroot folder.
Replace:
if (nodeClass == "parent" && element.getAttribute("showToolTip") != false) accessAnchor.title = textNode.innerText + " : " + L_strToolTip_Text;With:
var tooltiptext= el.getAttribute("NodeData"); //if (nodeClass == "parent" && element.getAttribute("showToolTip") != false) if (tooltiptext != null) { accessAnchor.title = tooltiptext; }
With this replacement the nodedata will be displayed a the tooltip.