Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > C#/.NET入门教程

为GridView的行添加鼠标经过、点击事件的小例子

来源:中文源码网    浏览:266 次    日期:2024-04-27 04:36:07
【下载文档:  为GridView的行添加鼠标经过、点击事件的小例子.txt 】


为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')"); } }

相关内容