Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

asp.net paging

Posted on 2011-09-14
3
Medium Priority
?
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

704 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