Solved

asp.net paging

Posted on 2011-09-14
3
190 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now