//删除 protected void dgCars_RowDeleting(object sender, GridViewDeleteEventArgs e) { int CarId = Convert.ToInt32(dgCars.DataKeys[e.RowIndex].Value); if (cm.DelCarById(CarId) > 0) { bindCars(); } }
protected void gvCars_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int CarId = Convert.ToInt32(gvCars.DataKeys[e.RowIndex].Value); if (cm.DelCarById(CarId) > 0) { bindCars(); ClientScript.RegisterStartupScript(this.GetType(), "ad", "alert('删除成功!!')", true); } } catch (Exception ex) { lblInfo.Text = ex.Message; } }