您现在的位置是:网站首页> 编程资料编程资料
为GridView的行添加鼠标经过、点击事件的小例子_实用技巧_
2023-05-25
416人已围观
简介 为GridView的行添加鼠标经过、点击事件的小例子_实用技巧_
复制代码 代码如下:
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')");
}
}
您可能感兴趣的文章:
相关内容
- asp.net中生成缩略图并添加版权实例代码_实用技巧_
- 浅谈.NET中加密和解密的实现方法分享_实用技巧_
- 轻松解决asp.net用户ASPNET登录失败问题的方法分享_实用技巧_
- .net开发:为程式码加上行号的方法详解_实用技巧_
- ASP.NET(C#) 读取EXCEL另加解决日期问题的方法分享_实用技巧_
- 在ASP.NET中插入flash代码实例_实用技巧_
- 创建基于ASP.NET的SMTP邮件服务的具体方法_实用技巧_
- ASP.NET DropDownListCheckBox使用示例(解决回发问题)_实用技巧_
- 一个.net 压缩位图至JPEG的实例代码_实用技巧_
- Attribute/特性心得随笔_实用技巧_
