protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string delAdoptID = GridView1.DataKeys[e.RowIndex].Value.ToString(); AdoptPet adoptPetone = new AdoptPet(); adoptPetone.DeleteAdoptPet(delAdoptID); }
protected void BtnDelete_Click(object sender, EventArgs e) { AdoptPet adoptPet = new AdoptPet(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxs"); if (cbox.Checked == true) { string sqlstr = GridView1.DataKeys[i].Value.ToString(); adoptPet.DeleteAdoptPet(sqlstr); } } BindGridNew(1); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string delAdoptID= GridView1.DataKeys[e.RowIndex].Value.ToString() ; AdoptPet adoptPetone = new AdoptPet(); adoptPetone.DeleteAdoptPet(delAdoptID); }