Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6991135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:27:17+00:00 2026-05-27T19:27:17+00:00

I am trying to get the next and prev button on my custom pager.

  • 0

I am trying to get the next and prev button on my custom pager. Here is what I have so far and it’s working perfect except it needs next and prev button.

What I have done

 PagedDataSource page = new PagedDataSource();

                page.AllowCustomPaging = true;
                page.AllowPaging = true;
                page.DataSource = query;
                page.PageSize = 5;
                QRep.DataSource = page;
                QRep.DataBind();

*Qrep is a asp.net repeater control and *query is a result of linq to sql query.

here is how i create the pager controls and assigned event handlers

private void CreatePagingControl()
    {
        for (int i = 0; i < (RowCount / 5) + 1; i++)
        {


            LinkButton lnk = new LinkButton();
            lnk.Click += new EventHandler(lbl_Click);
            lnk.ID = "lnkPage" + (i + 1).ToString();
            lnk.Text = (i + 1).ToString();
            plcPaging.Controls.Add(lnk);
            Label spacer = new Label();
            spacer.Text = "&nbsp;";
            plcPaging.Controls.Add(spacer);

        }

    }

    void lbl_Click(object sender, EventArgs e)
    {
        LinkButton lnk = sender as LinkButton;
        int currentPage = int.Parse(lnk.Text);
        int take = currentPage * 5;
        int skip = currentPage == 1 ? 0 : take - 5;
        FetchData(take, skip);
    }    

the row count is stored as below

private int RowCount
    {
        get
        {
            return (int)ViewState["RowCount"];
        }
        set
        {
            ViewState["RowCount"] = value;
        }
    }

This is working fine , except it only displays page numbers and I want to know how the next and prev controls can be integrated with this. Any help appreicated guys. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:27:17+00:00Added an answer on May 27, 2026 at 7:27 pm

    See the open source pager control for asp.net 3.5 here:
    http://www.codeproject.com/KB/custom-controls/ASPNETPagerControl.aspx

    Edit

    There is also another asp.net pager control with source code here:
    http://aspnetpager.codeplex.com/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a regexp to solve the next problem: I have some
When trying to get next activities it shows this error: This page contains the
I am trying to get an array of a date plus the next 13
Trying to get comfortable with jQuery and I have encountered some sample code that
I am trying to get the next highest PK in an SQLite database that
I'm trying to get the next item in a list of strings (postal codes).
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studios.R2.Express; What I'm trying to do, is get a button to
I have the following SQL Server query and I am trying to get the
well I have been trying to get Nivo Slider to work almost all day.
Been trying to get the Jquery plugin Easy Slider 1.7 working. been messing about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.