protected void btnDelete_Click(object sender, EventArgs e) { try { int ID = Globals.GetIntFromQueryString("ID"); WebDemo obj = new WebDemo(); DataSet ds = obj.GetWebDemoByID("WebDemo", Globals.AgentCatID, ID); Globals.DeleteFile(Convert.ToString(ds.Tables[0].Rows[0]["SmallImage"]), "ImageFiles/WebDemos"); Globals.DeleteFile(Convert.ToString(ds.Tables[0].Rows[0]["LargeImage"]), "ImageFiles/WebDemos"); obj.DeleteWebDemo(ID); Response.Redirect("DemoList.aspx"); } catch { } }
protected void gridViewDemoList_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { GridViewRow row = gridViewDemoList.Rows[e.RowIndex]; Int32 ID = Convert.ToInt32(((Label)row.Cells[0].FindControl("lblID")).Text); WebDemo obj = new WebDemo(); DataSet ds = obj.GetWebDemoByID("WebDemo", Globals.AgentCatID, ID); Globals.DeleteFile(Convert.ToString(ds.Tables[0].Rows[0]["SmallImage"]), "ImageFiles/WebDemos"); Globals.DeleteFile(Convert.ToString(ds.Tables[0].Rows[0]["LargeImage"]), "ImageFiles/WebDemos"); obj.DeleteWebDemo(ID); LoadGridViewDemoList(); } catch { } }