protected void grvCategories_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow editRow = grdListSupport.Rows[e.RowIndex]; ga.ID = Convert.ToInt32((editRow.FindControl("hiddenColorID") as HiddenField).Value); ga.Delete(); BindData(); }
public void DeleteTest() { Gallery gallery = new Gallery(); List <Models.Gallery> gallerys = new List <Models.Gallery>(); gallerys = gallery.Load(); Models.Gallery row = gallerys.Where(x => x.Id == 2).FirstOrDefault(); if (row != null) { bool actual = gallery.Delete(row.Id); Assert.IsTrue(actual == true); } }
protected void btnDeleteGallery_Click(object sender, EventArgs e) { Gallery.Delete(Convert.ToInt32(Request.Form["ctl00$ContentPlaceHolder1$ddGallery"])); Directory.Delete(@Server.MapPath("gallery/" + Request.Form["ctl00$ContentPlaceHolder1$ddGallery"]), true); Response.Redirect("~/admingallery.aspx"); }