Beispiel #1
0
        private void BindIndex()
        {
            IndexItemCollection searchResults = IndexHelper.Browse(
                siteSettings.SiteId,
                featureGuid,
                modifiedBeginDate,
                modifiedEndDate,
                pageNumber,
                pageSize,
                out totalHits);

            totalPages = 1;

            if (pageSize > 0)
            {
                totalPages = totalHits / pageSize;
            }

            if (totalHits <= pageSize)
            {
                totalPages = 1;
            }
            else
            {
                Math.DivRem(totalHits, pageSize, out int remainder);
                if (remainder > 0)
                {
                    totalPages += 1;
                }
            }

            string searchUrl = SiteRoot
                               + "/Admin/IndexBrowser.aspx?p={0}"
                               + "&amp;bd=" + modifiedBeginDate.Date.ToString("s")
                               + "&amp;ed=" + modifiedEndDate.Date.ToString("s")
                               + "&amp;f=" + featureGuid.ToString();

            pgrTop.PageURLFormat = searchUrl;
            pgrTop.ShowFirstLast = true;
            pgrTop.CurrentIndex  = pageNumber;
            pgrTop.PageSize      = pageSize;
            pgrTop.PageCount     = totalPages;
            pgrTop.Visible       = (totalPages > 1);

            pgrBottom.PageURLFormat = searchUrl;
            pgrBottom.ShowFirstLast = true;
            pgrBottom.CurrentIndex  = pageNumber;
            pgrBottom.PageSize      = pageSize;
            pgrBottom.PageCount     = totalPages;
            pgrBottom.Visible       = (totalPages > 1);

            if (searchResults.Count > 0 && searchResults.ItemCount > 0)
            {
                rptResults.Visible    = true;
                rptResults.DataSource = searchResults;
                rptResults.DataBind();
            }
        }