如题,asp.net2.0(c#)中的listbox控件怎么实现鼠标经过行变色,光标变手型以及双击事件?请给出详细代码,最好有实例..还有请自己先试过先,不要空谈,提示3点,listbox没有coursor甚至style属性,也没有e.row方法...gridview控件的行变色方法用不了listbox上,也没有直接可以用的双击事件,我知道winfomd有,但是我做的是web没有!这三点我都已经试过了,请问大虾们有没有好一点的方法?ListBox1.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#FFFFCC'");
ListBox1.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
我试过这两行代码,但是他是整个listbox鼠标经过变色,我要的是单行变色,谁知道怎么做,谢了,跪求!~
ListBox1.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
我试过这两行代码,但是他是整个listbox鼠标经过变色,我要的是单行变色,谁知道怎么做,谢了,跪求!~
for (int i = 0; i < ListBox1.Items.Count; i++)
{
ListItem item = ListBox1.Items[i] as ListItem;
item.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF';this.style.color='black'");
item.Attributes.Add("onmouseover", "this.style.backgroundColor='#C0C0FF';this.style.color='#ffffff'");
}
试下.
csdn有很多这样的问题!!
唯一解决的方法用Panel设置滚动条,或div设置滚动条,
pannel或div中放数据控件,如GridView,将GridView表格线去掉,
基本上做出来的和ListBox查不多!!
你只要设置panel或div的宽度和高度即可!!
<div style="width:100px; height:100px; overflow: scroll;">aaaaa</div>panele:
Panel1.ScrollBars = ScrollBars.Both;