private void PopulateControls()
        {
            int    howManyPages = 0;
            string page         = Request.QueryString["Page"] ?? "1";
            string firstPageUrl = Link.ToAdminProduct();
            string pagerUrl     = Link.ToAdminProduct("{0}");

            repProd.DataSource = Product.Paging(page, out howManyPages);
            repProd.DataBind();
            PagerTop.Show(int.Parse(page), howManyPages, firstPageUrl, pagerUrl, false);
            PagerBottom.Show(int.Parse(page), howManyPages, firstPageUrl, pagerUrl, true);
        }
Exemple #2
0
        private void PopulateControls()
        {
            int           pageSize    = GlobalConfiguration.ImagesPerPage;
            string        imageFolder = MapPath("~/ProductImages");
            DirectoryInfo dir         = new DirectoryInfo(imageFolder);

            FileInfo[] allFiles     = dir.GetFiles();
            int        totalFiles   = allFiles.Length;
            string     page         = Request.QueryString["Page"] ?? "1";
            int        howManyPages = (int)Math.Ceiling((double)totalFiles / (double)pageSize);
            int        currentPage  = int.Parse(page);
            int        skip         = (currentPage - 1) * pageSize;

            FileInfo[] files = allFiles.OrderByDescending(x => x.CreationTime).Skip(skip).Take(pageSize).ToArray();
            dlImage.DataSource = files;
            dlImage.DataBind();
            string firstPageUrl = Link.ToAdminUpload(id);
            string pagerUrl     = Link.ToAdminUpload(id, "{0}");

            PagerTop.Show(currentPage, howManyPages, firstPageUrl, pagerUrl, false);
            PagerBottom.Show(currentPage, howManyPages, firstPageUrl, pagerUrl, true);
        }