Exemple #1
0
        protected void btnDeleteAllChild_Click(object sender, EventArgs e)
        {
            var atLeastOneRowDeleted = false;
            // Iterate through the Products.Rows property

            var deleteChildItems = new List <string>();

            foreach (GridViewRow row in gridSitecoreItems.Rows)
            {
                // Access the CheckBox
                var cb = (CheckBox)row.FindControl("chkDeleteItem");
                if (cb != null && cb.Checked)
                {
                    // Delete row! (Well, not really...)
                    atLeastOneRowDeleted = true;
                    // First, get the ProductID for the selected row
                    var itemID = row.Cells[2].Text;

                    deleteChildItems.Add(itemID);
                }
            }

            if (deleteChildItems.Any())
            {
                DeleteResults.Text = BulkItemService.DeleteSelectedItems(deleteChildItems, "master");
                btnShowAllChild_Click(sender, e);
            }

            // Show the Label if at least one row was deleted...
            DeleteResults.Visible = atLeastOneRowDeleted;
        }
Exemple #2
0
        protected void btnShowAllChild_Click(object sender, EventArgs e)
        {
            litTotalResults.Visible      = false;
            chkall.Visible               = false;
            gridSitecoreItems.DataSource = "";
            gridSitecoreItems.DataBind();
            gridSitecoreItems.RowDataBound += GridSitecoreItems_RowDataBound;

            var subItems = BulkItemService.GetSubItems(txtParentItemId.Text, txtTemplateId.Text);

            if (subItems.SubItems != null && subItems.SubItems.Count > 0)
            {
                NoResultFound.Visible        = false;
                litTotalResults.Text         = "Total Items Found: " + subItems.SubItems.Count;
                litTotalResults.Visible      = true;
                gridSitecoreItems.DataSource = subItems.SubItems;
                gridSitecoreItems.DataBind();
                chkall.Visible = chkallunpublishable.Visible = btnDeleteAllChild.Visible = true;
            }
            else
            {
                NoResultFound.Text    = subItems.ResultMessage;
                NoResultFound.Visible = true;
                chkall.Visible        = chkallunpublishable.Visible = btnDeleteAllChild.Visible = false;
            }
        }