Spiga

海洋工作室——网站建设专家:VS.NET - ASP.NET -ToolTip per node in ASP.NET Treeview control

2009-09-09 11:33 by 海洋——海纳百川,有容乃大., 72 visits, 网摘, 收藏, 编辑

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.
0
0
(请您对文章做出评价)
« 上一篇:海洋工作室——网站建设专家:How To: Create an ASP.NET AJAX Style Folder Explorer
» 下一篇:海洋工作室——网站建设专家:为上海“90后公交售票妹妹”做宣传广告词