ASP.NET Gridview特效(持续更新中...)
2009-03-18 14:19
225 查看
1、鼠标滑过时,行变色效果:
在Gridview的RowDataBound事件中加入以下代码:
//判定当前的行是否属于datarow类型的行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标悬停在数据行上时,保存原来的行背景色并设置新的背景色
e.Row.Attributes.Add("onmouseover", "currentColor=this.style.backgroundColor;this.style.backgroundColor='green';");
//当鼠标移开后,将背景颜色恢复为原来的颜色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentColor;");
}
在Gridview的RowDataBound事件中加入以下代码:
//判定当前的行是否属于datarow类型的行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标悬停在数据行上时,保存原来的行背景色并设置新的背景色
e.Row.Attributes.Add("onmouseover", "currentColor=this.style.backgroundColor;this.style.backgroundColor='green';");
//当鼠标移开后,将背景颜色恢复为原来的颜色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentColor;");
}
相关文章推荐
- asp.net 2.0中一次性更新所有GRIDVIEW的记录
- ASP.net常用代码(持续更新)
- [ASP.NET]GridView自定义编辑,更新,取消,删除
- asp.net GridView手写事件,包括取主键、取值、更新、选择、删除
- asp.net 2.0中一次性更新所有GRIDVIEW的记录
- asp.net 2.0中一次性更新所有GRIDVIEW的记录
- [C#]asp.net开发微信公众平台----目录汇总-持续更新
- asp.net中ADO SQL数据库 笔记汇总 持续更新中
- asp.net 2.0中一次性更新所有GRIDVIEW的记录
- asp.net updatepanel里gridview更新需要点鼠标两次问题解决
- ASP.NET Core框架揭秘(持续更新中…)
- ASP.NET MVC 4 in Action文章系列说明【持续更新......】
- asp.net 2.0中一次性更新所有GRIDVIEW的记录 (翻译)
- [导入]asp.net 2.0中一次性更新所有GRIDVIEW的记录
- 使用ASP.NET Web Api构建基于REST风格的服务实战系列教程【开篇】【持续更新中。。。】
- asp.net连接数据持续更新中。
- asp.net gridview 无法更新数据
- How ASP.NET MVC Works?[持续更新中…]
- 新增格式化单元格数据功能-dotNetFlexGrid更新1.24版本,快速的设置您的表格数据的不同样式;现在开始扔掉你的Asp.net GridView吧。