海洋工作室——网站建设专家: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:
	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.
posted @ 2009-09-09 11:33  海洋——海纳百川,有容乃大.  阅读(242)  评论(0编辑  收藏  举报