为GridView的行添加鼠标经过、点击事件的小例子
2018-10-12 14:06
465 查看
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#95B8FF'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
e.Row.Attributes["style"] = "Cursor:hand";
int count = GridView1.Rows.Count;
string ID = "";
for (int i = 0; i < count; i++)
{
ID = GridView1.DataKeys[i].Value.ToString();
GridView1.Rows[i].Attributes.Add("onclick", "newwin=window.open('default3.aspx?ID=" + ID + "','newwin','width=500,height=550')");
}
}
您可能感兴趣的文章:
相关文章推荐
- 为GridView的行添加鼠标经过、点击事件的小例子
- 为GridView的行添加鼠标经过、点击的事件。
- 利用添加onmouseover事件,做一组鼠标经过时自动换图片的图形链接
- C# GridView 给某行或某列绑定点击事件和鼠标事件
- GridView的技巧 绑定行事件,取得单元格值,或取得单元格控件方法,鼠标经过样式
- GridView行 添加鼠标双击事件
- 扩展GridView实现多选(全选)、点击行任意位置选择行、选中变色、添加双击事件等
- 后台添加gridview事件(鼠标事件,单击双击事件)个人总结
- gridview中button添加事件以及获取点击button那行的索引和数据
- 【ASP.NET】3.为GridView每行添加js点击事件
- CSS 鼠标响应事件,鼠标经过CSS,鼠标移动CSS,鼠标点击CSS
- 为GridView添加鼠标事件
- CSS鼠标响应事件经过、移动、点击示例介绍
- GridView鼠标经过感知以及点击行弹出窗口
- GridView给行添加事件(鼠标移上移下更改行背景
- 动态添加class名,改变标签样式(包含鼠标移入、移出及点击事件)
- 扩展GridView实现多选(全选)、点击行任意位置选择行、选中变色、添加双击事件等
- 精通RecyclerView:打造ListView、GridView、瀑布流;学会添加分割线、 添加删除动画 、Item点击事件
- js中的事件响应,实现网页交互,鼠标点击、经过等
- [原创]扩展GridView实现多选(全选)、点击行任意位置选择行、选中变色、添加双击事件等