Exemplo n.º 1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        List <string> toDelete  = new List <string>();
        bool          isChecked = false;
        string        curID     = string.Empty;

        foreach (GridViewRow gvr in gvKnownPopulation.Rows)
        {
            isChecked = false;
            foreach (Control c in gvr.Controls)
            {
                foreach (Control child in c.Controls)
                {
                    if (child.ID == "chkDelete" && (child as CheckBox).Checked)
                    {
                        curID     = string.Empty;
                        isChecked = true;
                    }
                    if (child.ID == "lblID")
                    {
                        curID = (child as Label).Text;
                    }
                    if (isChecked && curID != string.Empty && !toDelete.Contains(curID))
                    {
                        toDelete.Add(curID);
                    }
                }
            }
        }
        foreach (string strID in toDelete)
        {
            bi.DeleteKnownPopulationByID(strID);
            Log.Info(Context.User.Identity.Name, Request.FilePath, Session, "Deleted Population", strID);
        }
        PopulateGrid();
    }