gridview鼠标经过某行改变样式、颜色并且单击弹出窗口

来源:互联网 发布:360数据恢复大师免费 编辑:程序博客网 时间:2024/04/30 06:44

protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
    {
      if (e.Row.RowType == DataControlRowType.DataRow)
        {
            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('要打开的文件?ID=" + ID + "','newwin','width=500,height=550')");
        }
    }

 
原创粉丝点击