GridView中点击CheckBox选中一行来改变此行的颜色 前台: 复制代码 代码如下: //居中显示 后台: 复制代码 代码如下: /// /// checkbox选中时,改变行颜色 /// /// /// protected void ckbSelect_CheckedChanged(object sender, EventArgs e) { for (int i = 0; i < this.gvStudent.Rows.Count; i++) { CheckBox cb = (CheckBox)this.gvStudent.Rows[i].FindControl("ckbSelect"); if (cb.Checked) { this.gvStudent.Rows[i].BackColor = System.Drawing.Color.FromName("#e2eaec"); } else { this.gvStudent.Rows[i].BackColor = System.Drawing.Color.Empty; } } }