GridView鼠标移动到哪行,哪行的背景色改变
2015-08-18 14:43
197 查看
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#ffcc33'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#ffcc33'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
}
}
protected void gridList_RowDataBound(object sender, GridViewRowEventArgs e) { //如果是绑定数据行 if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标经过时,行背景色变 e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA'"); //鼠标移出时,行背景色变 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'"); //行事件,千万不要写循环,本身ROWDATABOUND就是循环的 e.Row.Attributes.Add("dbclick", "可直接写JS代码也可写JS函数,然后前台设置JS函数"); //列事件,可以循环实现多列 e.Row.Cells[1].Attributes.Add("onclick", "showedit(this)"); e.Row.Cells[3].Attributes.Add("onclick", "showedit(this)"); } }
相关文章推荐
- 设计模式学习笔记一:UML类图
- 曾经的笔记迁移__函数指针
- 杭电ACM2048java做法
- 中文转拼音
- 知识体系的构建与总结——前言
- poj 2485:Highways
- DOM宽高及偏移
- PowerPC PPC460-S MMU(四 Storage Attribute)
- 第6章 JSP内建对象讲解及实例讲解
- 斐波那契数列 Java实现
- ngui 减少drawcalls方法一
- 曾经的笔记迁移__指针的类型
- 优秀程序员的良好的学习方式
- ORA-12560: TNS: 协议适配器错误的解决方法
- widows server 2003分区动态扩展(vm esxi5.0)
- Application类学习总结
- 内存泄露检测
- UINavigationController & UIViewContorller
- DateTimePicker控件自定义格式
- Navicat For Mysql快捷键