Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

custom paging

$
0
0
Hello friends,

I have 5 lac (or more in future) Data to access in my asp.net webform.
Currently using GridView with Custom Paging with repeater control.

Note : my codes are based on this :-

[^]

privatevoid 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++)
                {
                    if (i == 1)
                    {
                        pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPageIndex ));
                    }
                    else
                    {
                        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();
        }


But this
=>code is not functioning well for page no "1" and "First" option.
=>It generates around 10,000 (Page No) links if my page size is 50 records/page, which is look too odd.
=>facing sorting issue with this.


Can anyone tell me solution for the above or give me some alternative.

Viewing all articles
Browse latest Browse all 3938


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>