public void OnPageIndexChanged(object source, System.Web.UI.ImageClickEventArgs e)
        {
            if (oGrid != null)
            {
                int ps = PagerItemsPerPage;
                if (ps > 0)
                {
                    oGrid.PageSize = ps;
                    switch ((source as ImageButton).CommandName)
                    {
                    case "First":
                        oGrid.CurrentPageIndex = 0;
                        break;

                    case "Prev":
                        if (oGrid.CurrentPageIndex > 0)
                        {
                            oGrid.CurrentPageIndex--;
                        }
                        break;

                    case "Next":
                        oGrid.CurrentPageIndex++;
                        break;

                    case "Last":
                        oGrid.CurrentPageIndex = 55555;
                        break;
                    }
                }
                else
                {
                    DisablePaging();
                }
                if (DataSource == null)
                {
                    if (oFilter != null)
                    {
                        DataSource = oFilter.GenerateDataSource();
                    }
                }
                DataTable oDT = DataSource as DataTable;
                if (oDT != null)
                {
                    ValidateCurrentPage(oDT, oGrid.PageSize, oGrid.CurrentPageIndex);
                    BindGrid(DataSource, true);
                }
            }
        }
Exemplo n.º 2
0
        public void BindGrid()
        {
            ValidateCurrentPage(DataSource, Core.GetInt(txtItemsPerPage), Core.GetInt(txtPageNum));
            int curPageNum = Common.Web.Core.GetInt(txtPageNum);
            int pageSize   = Common.Web.Core.GetInt(txtItemsPerPage);

            oFilter.Clear();
            oFilter.ClearCustomSqlParam();
            for (int l = 0; l < oCustParams.Count; l = l + 2)
            {
                oFilter.AppendCustomSqlParam(oCustParams[l].ToString(), oCustParams[l + 1]);
            }
            oFilter.AppendCustomSqlParam(Admin.Config.PageNum, curPageNum);
            oFilter.AppendCustomSqlParam(Admin.Config.PageSize, pageSize);
            DataSource = oFilter.GenerateDataSource(false);
            BindGrid(DataSource);
        }