Ejemplo n.º 1
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                var part = StaticBlockService.GetPagePart(SQLDataHelper.GetInt(grid.UpdatedRow["ID"]));

                part.InnerName = grid.UpdatedRow["InnerName"];
                part.Key       = grid.UpdatedRow["[Key]"];
                part.Enabled   = SQLDataHelper.GetBoolean(grid.UpdatedRow["Enabled"]);

                if (part.InnerName.IsNotEmpty() && part.Key.IsNotEmpty())
                {
                    StaticBlockService.UpdatePagePart(part);
                }
            }

            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            };

            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == (data.Rows[intIndex]["ID"]).ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Ejemplo n.º 2
0
 private void LoadStaticBlock()
 {
     try
     {
         var part = StaticBlockService.GetPagePart(_staticBlockId);
         txtKey.Text           = part.Key;
         txtPageTitle.Text     = part.InnerName;
         CKEditorControl1.Text = part.Content;
         chbEnabled.Checked    = part.Enabled;
         lblSubHead.Text       = Resource.Admin_PagePart_Edit;
     }
     catch (Exception ex)
     {
         MsgErr(ex.Message + " at LoadStaticBlock");
         //Debug.LogError(ex, _staticBlockId);
         Debug.LogError(ex, "at LoadStaticBlock");
     }
 }