阅读背景:

运用Button删除GridView中CheckBox选中行_liukaixuan917的专栏

来源:互联网 
protected void Button3_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in this.GridView1.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                CheckBox ckb = row.Cells[0].FindControl("CheckBox1") as CheckBox;
                if (ckb.Checked)
                {
                    int i = Convert.ToInt32(row.Cells[1].Text);
                    string str = ConfigurationManager.ConnectionStrings["studentConnectionString"].ConnectionString;
                    using (SqlConnection cnn = new SqlConnection(str))
                    {
                        SqlCommand cmm = cnn.CreateCommand();
                        cmm.CommandText = "delete from student where protected void Button3_Click(object sender, Eve



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: