Repeater Pagination For Bulk Record I Need pageination For 10 Recordes Example i Select page 5 maximum page is 10 Minumn page is 1. if i Select page 17 Maximum Page is 22 minimum page is 12
- private void BindPager(int totalRecordCount, int currentPageIndex, int pageSize)
- {
- double getPageCount = (double)((decimal)totalRecordCount / (decimal)pageSize);
- int pageCount = (int)Math.Ceiling(getPageCount);
- List<ListItem> pages = new List<ListItem>();
- if (pageCount > 1)
- {
- pages.Add(new ListItem("FIRST", "1", currentPageIndex > 1));
- for (int i = 1; i <= pageCount; i++)
- {
- pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPageIndex + 1));
- }
- pages.Add(new ListItem("LAST", pageCount.ToString(), currentPageIndex < pageCount - 1));
- }
- rptPager.DataSource = pages;
- rptPager.DataBind();
- }