コード例 #1
0
        protected void PrevNext()
        {
            int iTotalPages = this.TotalRecords / this.PageSize;

            if ((this.TotalRecords % this.PageSize) > 0)
            {
                iTotalPages++;
            }

            if (!String.IsNullOrEmpty(this.LinkNext))
            {
                PagedDataNextPrevLinkPair pair = FindPrevNextCtrl(this.LinkNext);

                int iPageNum = this.PageNumber + 1;

                bool bShowLink = (iPageNum < this.MaxPage && this.MaxPage > 0) || this.PageNumber < iTotalPages;

                SetNextPrevLinkVisibility(PagedDataNextPrevLinkWrapper.PagedDataDirection.Next, pair, iPageNum, bShowLink);
            }

            if (!String.IsNullOrEmpty(this.LinkPrev))
            {
                PagedDataNextPrevLinkPair pair = FindPrevNextCtrl(this.LinkPrev);

                int  iPageNum  = this.PageNumber - 1;
                bool bShowLink = this.PageNumber > 1;

                SetNextPrevLinkVisibility(PagedDataNextPrevLinkWrapper.PagedDataDirection.Previous, pair, iPageNum, bShowLink);
            }

            if (!String.IsNullOrEmpty(this.LinkFirst))
            {
                PagedDataNextPrevLinkPair pair = FindPrevNextCtrl(this.LinkFirst);

                int  iPageNum  = 1;
                bool bShowLink = (this.PageNumber > iPageNum);

                SetNextPrevLinkVisibility(PagedDataNextPrevLinkWrapper.PagedDataDirection.First, pair, iPageNum, bShowLink);
            }

            if (!String.IsNullOrEmpty(this.LinkLast))
            {
                PagedDataNextPrevLinkPair pair = FindPrevNextCtrl(this.LinkLast);

                int iPageNum = iTotalPages;

                if (this.MaxPage > 0)
                {
                    iPageNum = this.MaxPage;
                }

                bool bShowLink = (this.PageNumber < iPageNum);

                SetNextPrevLinkVisibility(PagedDataNextPrevLinkWrapper.PagedDataDirection.Last, pair, iPageNum, bShowLink);
            }
        }
コード例 #2
0
        protected PagedDataNextPrevLinkPair FindPrevNextCtrl(string sCtrlName)
        {
            PagedDataNextPrevLinkPair pair = new PagedDataNextPrevLinkPair();

            try {
                ControlUtilities cu   = new ControlUtilities(this.Page);
                Control          ctrl = cu.FindControl(sCtrlName, this.Page);
                pair.LinkWrapper = (PagedDataNextPrevLinkWrapper)ctrl;
                if (pair.LinkWrapper == null)
                {
                    pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(sCtrlName, this.Page);
                }
                else
                {
                    pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(typeof(PagedDataNextPrevLink), pair.LinkWrapper);
                }
            } catch (Exception ex) { }

            return(pair);
        }
コード例 #3
0
        protected void SetNextPrevLinkVisibility(PagedDataNextPrevLinkWrapper.PagedDataDirection dir, PagedDataNextPrevLinkPair lnkPair, int iPage, bool ShowLink)
        {
            if (lnkPair.PageLink != null) {
                SetNextPrevLink(dir, lnkPair.PageLink, iPage);
                lnkPair.PageLink.Visible = ShowLink;
            }

            if (lnkPair.LinkWrapper != null) {
                lnkPair.LinkWrapper.Visible = ShowLink;
            }
        }
コード例 #4
0
        protected void SetNextPrevLinkVisibility(PagedDataNextPrevLinkWrapper.PagedDataDirection dir, PagedDataNextPrevLinkPair lnkPair, int iPage, bool ShowLink)
        {
            if (lnkPair.PageLink != null)
            {
                SetNextPrevLink(dir, lnkPair.PageLink, iPage);
                lnkPair.PageLink.Visible = ShowLink;
            }

            if (lnkPair.LinkWrapper != null)
            {
                lnkPair.LinkWrapper.Visible = ShowLink;
            }
        }
コード例 #5
0
        protected PagedDataNextPrevLinkPair FindPrevNextCtrl(string sCtrlName)
        {
            PagedDataNextPrevLinkPair pair = new PagedDataNextPrevLinkPair();

            try {
                ControlUtilities cu = new ControlUtilities(this.Page);
                Control ctrl = cu.FindControl(sCtrlName, this.Page);
                pair.LinkWrapper = (PagedDataNextPrevLinkWrapper)ctrl;
                if (pair.LinkWrapper == null) {
                    pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(sCtrlName, this.Page);
                } else {
                    pair.PageLink = (PagedDataNextPrevLink)cu.FindControl(typeof(PagedDataNextPrevLink), pair.LinkWrapper);
                }
            } catch (Exception ex) { }

            return pair;
        }