Solved

asp.net paging

Posted on 2011-09-14
3
199 Views
Last Modified: 2012-05-12
I have attached paging in asp.net/vb.net
and it lists all of page number. what I prefer is
showing as follow:

<< 1 2 3 4 5 >>

so it only shows 5 at a page.

Is that possible?

For i = 1 To TotalRecordCountClient
                    SelectedPartNo = SingleItem(Category, i)
                    If i = QueryStringRowNumber Then
                        p.Append("<font size=""2"">" & " " & i & " " & "</font>")
                    Else
                        p.Append("<a href=""http://www.abc.com/Default.aspx?PL=Sitemap&RowNumber=" & i & "&id0=" & Category & "&PartNo=" & SelectedPartNo & """><font color=blue>" & i & "</font></a>" & " ")
                    End If
                Next

Open in new window

0
Comment
Question by:Webboy2008
  • 2
3 Comments
 
LVL 16

Expert Comment

by:disrupt
ID: 36540088
You can do something like this below, you will need logic though to determine what page you are in and if it is less than TotalRecordCountClient by at least five if not return the difference and append that to the legnth.
int length = 5;
        int start = 1;

        protected void Page_Load(object sender, EventArgs e)
        {
            IEnumerable<int> next = Enumerable.Range(start, length).Select(x => x);

            foreach (int num in next)
            {
                Response.Write(num + "<br/>");
            }

        }

Open in new window

0
 

Author Comment

by:Webboy2008
ID: 36540102
can you send me completed working codes with like << 1 2 3 4 5 >>?
If I copy/paste your codes to there, I don't think it is working.
0
 
LVL 16

Accepted Solution

by:
disrupt earned 500 total points
ID: 36540106
My code wasn't intended to copy/paste it was to start you out and build the 1-5 page once you click on a 1-5 page you need to pass the current page number into start which will give you the next five and so on....
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question