protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

    {

        //如果是绑定数据行

        if (e.Row.RowType == DataControlRowType.DataRow)

        {

            ////鼠标经过时,行背景色变

           e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='" + this.OnMouseOverColcr + "';");

              ////鼠标移出时,行背景色变 
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
    

      
                    ////当有编辑列时,避免出错,要加的RowState判断

            //if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)

            //{

            //    ((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick", " confirm('你确认要删除:\"" + e.Row.Cells[1].Text + "\"吗?')");

            //}

        }

        if (e.Row.RowIndex != -1)

        {

            int + 1;

            e.Row.Cells[0].Text = id.ToString();

        }

    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2021-05-22
  • 2021-09-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-11
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
相关资源
相似解决方案