Exemplo n.º 1
0
    //handle delete event
    protected void imgbtnDelete_Click(object sender, EventArgs e)
    {
        productManager objproduct = new productManager();

        try
        {
            int      con        = 0;
            CheckBox chk        = new CheckBox();
            string   ActImage   = string.Empty;
            string   ThumbImage = string.Empty;
            DataSet  dsadmin    = new DataSet();

            for (int i = 0; i < gvAdmin.Rows.Count; i++)
            {
                chk = (CheckBox)(gvAdmin.Rows[i].FindControl("chkDelete"));
                if (chk.Checked == true)
                {
                    con += 1;
                    objproduct.productId = Convert.ToInt32(gvAdmin.DataKeys[gvAdmin.Rows[i].RowIndex].Value.ToString());
                    // objuser.DeleteAdminRightsItem();
                    objproduct.DeleteItem();
                    //Menu delete logic goes here
                    //if (System.IO.File.Exists(Server.MapPath("~") + "/admin/menu/" + objuser.adminid + ".htm"))
                    //{
                    //    System.IO.File.Delete(Server.MapPath("~") + "/admin/menu/" + objuser.adminid + ".htm");
                    //}
                }
            }
            Response.Redirect("viewinventory.aspx?flag=delete&key=" + txtsearch.Text + "");
            //Response.Redirect("viewinventory.aspx?flag=delete");
        }
        catch (Exception ex) { throw ex; }
        finally { objproduct = null; }
    }