Exemple #1
0
        /// <summary>
        /// generate page items
        /// </summary>
        private static void SetAvailablePages(DataPaging d)
        {
            if (d.PageNumber <= 0)
                return;
            int start = 1;
            int max = d.PageNumber;
            int x = d.PageNumber % d.AvailablePagesCount;
            int y = d.PageNumber / d.AvailablePagesCount;
            if (y > 0 && x > 0)
            {
                max = Math.Min(((y + 1) * d.AvailablePagesCount), d.PageCount);
                start = y * d.AvailablePagesCount + 1;
            }
            if (y == 0)
            {
                max = Math.Min(d.AvailablePagesCount, d.PageCount);
            }
            if (x == 0)
            {
                start = (y - 1) * d.AvailablePagesCount + 1;
            }

            d.listAvailablePage.Items.Clear();
            for (int i = start; i <= max; i++)
            {
                d.listAvailablePage.Items.Add(i);
            }
            d.listAvailablePage.SelectedValue = d.PageNumber;
        }
Exemple #2
0
 /// <summary>
 /// Common Function to enable / disable paging buttons
 /// </summary>
 /// <param name="objGrid"></param>
 protected static void EnableDisableButtons(DataPaging objGrid)
 {
     if (null != objGrid.btnNext)
     {
         objGrid.btnNext.IsEnabled = true;
         objGrid.btnPrev.IsEnabled = true;
         if (objGrid.PageNumber <= 1)
             objGrid.btnPrev.IsEnabled = false;
         if (objGrid.PageNumber >= objGrid.PageCount)
             objGrid.btnNext.IsEnabled = false;
     }
 }