Pothi Sam

Pothi Sam

  • NA
  • 335
  • 50.7k

Repeater Pagination For Bulk Record

Apr 15 2020 1:52 AM
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
  1. private void BindPager(int totalRecordCount, int currentPageIndex, int pageSize)  
  2. {  
  3. double getPageCount = (double)((decimal)totalRecordCount / (decimal)pageSize);  
  4. int pageCount = (int)Math.Ceiling(getPageCount);  
  5. List<ListItem> pages = new List<ListItem>();  
  6. if (pageCount > 1)  
  7. {  
  8. pages.Add(new ListItem("FIRST""1", currentPageIndex > 1));  
  9. for (int i = 1; i <= pageCount; i++)  
  10. {  
  11. pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPageIndex + 1));  
  12. }  
  13. pages.Add(new ListItem("LAST", pageCount.ToString(), currentPageIndex < pageCount - 1));  
  14. }  
  15. rptPager.DataSource = pages;  
  16. rptPager.DataBind();  

 

Answers (1)