复制代码 代码如下:
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')");
}
}
您可能感兴趣的文章:- 用javascript css实现GridView行背景色交替、鼠标划过行变色,点击行变色选中
- asp.net GridView和DataList实现鼠标移到行行变色
- asp.net GridView控件鼠标移动某行改变背景颜色(方法一)
- js实现GridView单选效果自动设置交替行、选中行、鼠标移动行背景色
- asp.net Gridview数据列中实现鼠标悬浮变色
- asp.net中GridView数据鼠标移入显示提示信息