为GridView的行添加鼠标经过、点击事件的小例子
更新时间:2013年11月06日 16:45:44 作者:
这篇文章介绍了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.NET2.0:页面中链入的CSS、js文件带中文时需注意
ASP.NET2.0:页面中链入的CSS、js文件带中文时需注意...2006-09-09
XmlReader 读取器读取内存流 MemoryStream 的注意事项
XmlReader 读取器读取内存流 MemoryStream 的注意事项...2007-04-04
asp.net sqlconnection con.close和con.dispose区别
con.close是用来关闭和数据库的连接,相对于open2008-12-12


最新评论