为GridView的行添加鼠标经过、点击事件的小例子_asp.net教程-查字典教程网
为GridView的行添加鼠标经过、点击事件的小例子
为GridView的行添加鼠标经过、点击事件的小例子
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:protectedvoidGridView1_RowDataBound(objectsender,GridViewRowE...

复制代码 代码如下:

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教程学习
    热门asp.net教程学习
    编程开发子分类