protected void btnDelete_Click(object sender, EventArgs e) { try { Int32 ServiceID = Globals.GetIntFromQueryString("ServiceID"); OtherFunctions obj = new OtherFunctions(); String imageFileName = obj.GetServiceImageUrlByServiceID(ServiceID); Globals.DeleteFile(imageFileName); obj.DeleteService(ServiceID); Response.Redirect("ServiceList.aspx"); } catch { } }
protected void gridViewService_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { GridViewRow row = gridViewService.Rows[e.RowIndex]; Int32 ServiceID = Convert.ToInt32(((Label)row.Cells[0].FindControl("lblServiceID")).Text); OtherFunctions obj = new OtherFunctions(); String imageFileName = obj.GetServiceImageUrlByServiceID(ServiceID); Globals.DeleteFile(imageFileName, "ImageFiles/Services"); obj.DeleteService(ServiceID); LoadGridViewService(ddlLanguage.SelectedValue); } catch { } }