下拉列表项的工具提示 [英] Tooltip for Drop down list items
本文介绍了下拉列表项的工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个下拉列表,我想为下拉列表项添加工具提示。
我尝试使用以下代码,但它不起作用;
I have a dropdownlist and I want to add tooltip for dropdownlist items. I tried with following code, but it does not work;
for(int d=0;d<drpID.Items.Count;d++)
{
drpID.Items[d].Attributes.Add("title", drpID.Items[d].Value);
}
任何人都可以帮助我吗?
Can anyone help me on this?
推荐答案
尝试这样;
public void Tooltip(ListControl lc)
{
for (int d = 0; d < lc.Items.Count; d++)
{
lc.Items[d].Attributes.Add("title", lc.Items[d].Text);
}
}
您应该使用 .Text
属性的工具提示,而不是 .Value
。
You should use .Text
property for tooltip, not for .Value
.
查看此链接: http://www.dotnetspider.com/resources /5099-Tool-tip-for-DropDownList-ASP-NET.aspx
这篇关于下拉列表项的工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文