鼠标移过GridView的行,前景色和背景色发生变化
来源:互联网 发布:外星人源码网终身会员 编辑:程序博客网 时间:2024/06/05 19:25
ASP.net 2.0 学习之001:鼠标移过GridView的行,前景色和背景色发生变化
1、右击“GridView ”,选择“属性”--“事件”,选择“数据”下的“RowDataBound ”属性,双击它。
2、在“GridView1_RowDataBound ”方法下加入下列代码:
if (e.Row.RowType == DataControlRowType.DataRow)
...{
//鼠标移动到每项时颜色交替效果
e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");
}
...{
//鼠标移动到每项时颜色交替效果
e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");
}
3、保存所有文件,运行一下,发现鼠标在“GridView ”表格范围内移动时,每行的背景色发生变化,文字的颜色也变了。
4、这个小计巧很实用,可以很醒目地查看正在查看的记录。
5、以上资料来自 【ChengKing(ZhengJian)】 的博客,在此感谢!
- 鼠标移过GridView的行,前景色和背景色发生变化
- GridView , 正常行背景色,交替行背景色,鼠标指向行背景色,鼠标点击后背景色
- GridView鼠标移动到哪行,哪行的背景色改变
- vc 前景色和背景色的意义和使用
- 如何设置文字的前景色和背景色
- 设置文字的前景色和背景色
- C#更改控制台文本的前景色和背景色
- C#更改控制台文本的前景色和背景色
- 改变cmd窗口的前景色和背景色
- 怎么设置dos框的背景色和前景色~
- 进度条前景色和背景色改变
- 设置背景色和前景色
- 文档前景色和背景色设置
- GridView的Item选中后,背景色会有变化,如何才能去除这个背景色呢,
- Android_Button背景色的变化
- GridView的小技巧(1)--如何实现鼠标划过改变GridView的行背景色
- 鼠标移到GridView某一行时改变该行的背景色
- 鼠标移到GridView某一行时改变该行的背景色
- Exchange服务器通讯端口
- C++ Develop Tools
- C/C++语言中指向函数的指针
- 告诉你怎么杀winlogon.exe病毒
- PowerCHM version 5.5 Build 0401
- 鼠标移过GridView的行,前景色和背景色发生变化
- computer networks, fourth edition
- CppUnit源码解读
- 一个24岁上海漂亮公务员的工资单,看了心凉一截
- VB decompiler v2.5 (05.08.06) by GPcH
- 搞笑专贴
- "我的电脑"无法打开的问题的解决
- 给图片加阴影效果的CSS
- 防止表格被撑宽的css