当前位置: 移动技术网 > IT编程>开发语言>.net > 为GridView的行添加鼠标经过、点击事件的小例子

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

2017年12月12日  | 移动技术网IT编程  | 我要评论

欺凌尤娜,重生之征战天下,红唇劫

复制代码 代码如下:

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网