gridview中checkbox不可选
- C# code
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.Label1.Text = ""; CheckBox ck = (CheckBox)this.GridView1.Rows[e.RowIndex].Cells[4].Controls[0]; bool b = ck.Checked; if (!b) { string uname = this.GridView1.Rows[e.RowIndex].Cells[1].Text.ToString(); string date = this.GridView1.Rows[e.RowIndex].Cells[3].Text.ToString(); string num = this.GridView1.Rows[e.RowIndex].Cells[2].Text.ToString(); if (bs.doProcedure("exec prc_addcoins '" + uname + "','" + date + "'," + num)) { this.Label1.Text = "<script>alert('处理成功')</script>"; this.fillTable(); } } else { this.Label1.Text = "<script>alert('已经处理')</script>";
本人想在gridview中增加checkbox选中后更新数据功能,但调试后checkbox不可选,求各位大虾帮忙求解。
[解决办法]
除了代码之外,还有一个很细节的问题,就是当datagridview设为ReadOnly属性时候,添加的CheckBox是不可选的,所以不能把dataGridView设为只读的