示例#1
0
 private void RetrieveRecords(StringCollection sc, Command cmd)
 {
     try
     {
         ShowSelectedRecords(sc, cmd);
         var dt1 = new DataTable();
         if (_getData != null)
         {
             dt1 = _getData();
             MainGridView.DataSource = dt1;
             MainGridView.DataBind();
         }
         oGridPagiation = new GridPagiation();
         oGridPagiation.Setup(plcPaging, litPagingSummary, lblCacheStatus, dt1, MainGridView, Page, SettingCategory);
         oGridPagiation.Changed += oGridPagiation_Changed;
         oGridPagiation.ManagePaging(dt1);
     }
     catch (Exception ex)
     {
         string msg = "Deletion Error:";
         msg += ex.Message;
         throw new Exception(msg);
     }
     finally
     {
     }
 }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="tableFolder"></param>
        /// <param name="primaryKey"></param>
        /// <param name="pageLoad"></param>
        /// <param name="getDataDelegate"></param>
        /// <param name="getColumnDelegate"></param>
        /// <param name="isPaging">flag for paging</param>
        public void Setup(string tableName, string tableFolder, string primaryKey, bool pageLoad, GetDataDelegate getDataDelegate, GetColumnDelegate getColumnDelegate, bool isPaging, bool isUpdateColumn = true, bool isDeleteColumn = true, string userPreferenceCategory = "")
        {
            _getData           = getDataDelegate;
            _getColumnDelegate = getColumnDelegate;

            ViewState["TableFolder"] = tableFolder;
            if (!string.IsNullOrEmpty(SessionVariables.ActiveTableName))
            {
                SessionVariables.ActiveTableName = tableName;
            }

            if (!string.IsNullOrEmpty(SessionVariables.ActiveTableName) && !(SessionVariables.ActiveTableName.Equals(tableName)))
            {
                SessionVariables.ActiveTableName = tableName;
            }
            if (CurrentPageIndex == null)
            {
                CurrentPageIndex = 0;
            }

            ViewState["TableName"]  = tableName;
            ViewState["PrimaryKey"] = primaryKey;
            //ViewState["IsTesting"] = SessionVariables.IsTesting;
            ViewState["PageLoad"]    = pageLoad;
            MainGridView.AllowPaging = isPaging;

            if (string.IsNullOrEmpty(userPreferenceCategory))
            {
                UserPreferenceCategory = tableName;
            }
            else
            {
                UserPreferenceCategory = userPreferenceCategory;
            }
            SetUserPreferenceCategory();

            if (isPaging)
            {
                MainGridView.PageSize = SessionVariables.DefaultRowCount;

                oGridPagiation = new GridPagiation();
                oGridPagiation.Setup(plcPaging, litPagingSummary, lblCacheStatus, dtGlobal, MainGridView, Page, SettingCategory);
                oGridPagiation.Changed += oGridPagiation_Changed;
                if (CurrentPageIndex != null)
                {
                    oGridPagiation.PageIndexInSession = CurrentPageIndex.Value;
                }
                oGridPagiation.ManagePaging(dtGlobal);
            }

            this.IsUpdateColumn = isUpdateColumn;
            this.IsDeleteColumn = isDeleteColumn;
        }
示例#3
0
        protected void lnkfontlarger_Click(object sender, EventArgs e)
        {
            //griddiv.Style.Add("font-size", "16px");
            //MainGridView.CssClass = "largerfontgrid";
            MainGridView.DataBind();

            oGridPagiation = new GridPagiation();
            dtGlobal       = _getData();
            oGridPagiation.Setup(plcPaging, litPagingSummary, lblCacheStatus, dtGlobal, MainGridView, Page, SettingCategory);
            oGridPagiation.Changed += oGridPagiation_Changed;
            oGridPagiation.ManagePaging(dtGlobal);
            if (!string.IsNullOrEmpty(SessionVariables.SortExpression) && !string.IsNullOrEmpty(SessionVariables.SortDirection))
            {
                SortGridView(SessionVariables.SortExpression, SessionVariables.SortDirection);
            }
            //MainGridView.CssClass = "largerfontgrid";
        }
示例#4
0
        protected void GridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            //In-built paging implementation
            MainGridView.PageIndex = e.NewPageIndex;
            MainGridView.DataBind();

            CurrentPageIndex = e.NewPageIndex;

            //Synchronize with custom paging


            oGridPagiation = new GridPagiation();
            dtGlobal       = _getData();
            oGridPagiation.Setup(plcPaging, litPagingSummary, lblCacheStatus, dtGlobal, MainGridView, Page, SettingCategory);
            oGridPagiation.Changed           += oGridPagiation_Changed;
            oGridPagiation.PageIndexInSession = e.NewPageIndex;
            oGridPagiation.ManagePaging(dtGlobal);
            if (!string.IsNullOrEmpty(SessionVariables.SortExpression) && !string.IsNullOrEmpty(SessionVariables.SortDirection))
            {
                SortGridView(SessionVariables.SortExpression, SessionVariables.SortDirection);
            }
        }
示例#5
0
        private void RefreshGrid()
        {
            if (CurrentPageIndex != null)
            {
                MainGridView.PageIndex = CurrentPageIndex.Value;
            }
            else
            {
                MainGridView.PageIndex = 0;
            }
            MainGridView.DataBind();

            oGridPagiation = new GridPagiation();
            dtGlobal       = _getData();
            oGridPagiation.Setup(plcPaging, litPagingSummary, lblCacheStatus, dtGlobal, MainGridView, Page, SettingCategory);
            oGridPagiation.Changed           += oGridPagiation_Changed;
            oGridPagiation.PageIndexInSession = MainGridView.PageIndex;
            oGridPagiation.ManagePaging(dtGlobal);
            if (!string.IsNullOrEmpty(SessionVariables.SortExpression) && !string.IsNullOrEmpty(SessionVariables.SortDirection))
            {
                SortGridView(SessionVariables.SortExpression, SessionVariables.SortDirection);
            }
        }
示例#6
0
        protected void chkSelectAll_CheckedChanged(object sender, EventArgs e)
        {
            int currentpage             = MainGridView.PageIndex;
            int currentpagesize         = MainGridView.PageSize;
            int totalnumofrows          = MainGridView.Rows.Count;
            var floor                   = (currentpage * currentpagesize);
            var ceil                    = ((currentpage * currentpagesize) + currentpagesize) - 1;
            StringCollection sc         = new StringCollection();
            string           id         = String.Empty;
            DataTable        dt1        = new DataTable();
            CheckBox         selectall  = (CheckBox)MainGridView.HeaderRow.Cells[0].FindControl("chkSelectAll");
            bool             chkchecked = selectall.Checked;

            if (!string.IsNullOrEmpty(SessionVariables.SortExpression) && !string.IsNullOrEmpty(SessionVariables.SortDirection))
            {
                skipgridreload = true;
                dt1            = SortGridView(SessionVariables.SortExpression, SessionVariables.SortDirection);
                skipgridreload = false;
            }
            else
            {
                dt1 = dtGlobal;
            }
            MainGridView.DataSource = dt1;
            MainGridView.DataBind();
            oGridPagiation = new GridPagiation();
            oGridPagiation.Setup(plcPaging, litPagingSummary, lblCacheStatus, dt1, MainGridView, Page, SettingCategory);
            oGridPagiation.Changed += oGridPagiation_Changed;
            oGridPagiation.ManagePaging(dt1);
            selectall         = (CheckBox)MainGridView.HeaderRow.Cells[0].FindControl("chkSelectAll");
            selectall.Checked = chkchecked;
            //loop the GridView Rows
            int j = 0;

            for (var i = floor; i <= ceil; i++)
            {
                if (j < MainGridView.Rows.Count)
                {
                    CheckBox cb = (CheckBox)MainGridView.Rows[j].Cells[0].FindControl("CheckBox1"); //find the CheckBox

                    if (cb != null && selectall != null)
                    {
                        if (selectall.Checked)
                        {
                            if (!cb.Checked)
                            {
                                cb.Checked = true; // add the id to be deleted in the StringCollection
                            }
                        }
                        else
                        {
                            if (cb.Checked)
                            {
                                cb.Checked = false;
                            }
                        }
                    }

                    j++;
                }
            }
        }