Results 1 to 4 of 4

Thread: Need ASP paging navigation help!

  1. #1
    Join Date
    Feb 2009
    Posts
    12

    Need ASP paging navigation help!

    Hi,

    I have my website in ASP.net
    I want to display the paging in a different manner such as this!

    Normally what we get is like
    1 | 2 | 3 | 4 | 5 | Next

    But i want it in this way to be displayed

    10 | 9 | 8 | 7 | 6 | Previous


    Is this possible?

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Need ASP paging navigation help!


  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Need ASP paging navigation help!

    To provide custom navigation controls

    1. Add server controls to the Web Forms page that the user can use to navigate. For example, you may want to create ImageButton controls with forward and reverse images on them.
    2. In the event handlers for the navigation controls, set the DataGrid control's CurrentPageIndex property to the page to go to, and then rebind the grid to the data source.

    The below snippet shows how you can create code for a custom navigation panel that allow the user to go to the first, last, previous, or next page. The paging elements are defined as <asp:Button> controls whose CommandArgument property is set to indicate what page they go to. All four buttons call the following method when they are clicked.

    Code:
    void setPageCustom ( object src, EventArgs e ) {
       // used by custom paging UI
       string direction = ( ( Button ) sender ).CommandArgument;
    
       switch ( direction ) {
          case ( "first" ) :
             myGrid.CurrentPageIndex = 0;
             break;
          case ( "prev" ) :
             if ( myGrid.CurrentPageIndex > 0 )
                myGrid.CurrentPageIndex --;
             break;
          case ( "next" ) :
             if ( myGrid.CurrentPageIndex < ( myGrid.PageCount - 1 ) )
                myGrid.CurrentPageIndex ++;
             break;
          case ( "last" ) :
             myGrid.CurrentPageIndex = ( myGrid.PageCount - 1 );
             break;
       }
       BindGrid ( );
    }

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Need ASP paging navigation help!

    You mean showing 5 , 4 , 3 , 2 , 1 instead of 1 , 2 , 3 , 4 , 5 , and selecting the 5th page first (for example)? I think that what you could do to achieve that is to put direction RTL on the FooterStyle (by setting some CSS class which has (direction: rtl in it, and then on Page_Init set the GridView1.PageIndex = GridView1.PageCount - 1; this way the last page would always be selected first and it would seem as if it's the first page.

Similar Threads

  1. How to defragment the paging file
    By SoftWore in forum Tips & Tweaks
    Replies: 1
    Last Post: 31-08-2010, 07:38 PM
  2. Reading pdf on iPad and paging down
    By Menominee in forum Portable Devices
    Replies: 6
    Last Post: 25-07-2010, 12:55 AM
  3. Paging using PHP
    By Dyumani in forum Software Development
    Replies: 3
    Last Post: 28-04-2009, 11:32 AM
  4. Paging consumption
    By Arlo in forum Operating Systems
    Replies: 6
    Last Post: 08-10-2008, 05:59 PM
  5. Paging Results
    By Waffle in forum Software Development
    Replies: 3
    Last Post: 06-10-2008, 04:10 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,633,033.90846 seconds with 17 queries