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不可选,求各位大虾帮忙求解。
{
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不可选,求各位大虾帮忙求解。
CheckBox ck = (CheckBox)this.GridView1.Rows[e.RowIndex].FindControl("controlName");
这样试一试
CheckBox ck = (CheckBox)this.GridView1.Rows[e.RowIndex].Cells[4].Controls[0];
ck.Enabled=true;