首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

gridview中checkbox不可选解决方法

2012-06-05 
gridview中checkbox不可选C# code protected void GridView1_RowDeleting(object sender, GridViewDeleteE

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设为只读的

热点排行