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 8315233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:05:10+00:00 2026-06-08T21:05:10+00:00

I need paging on my web page. I use PagedDataSource for it. but I

  • 0

I need paging on my web page. I use PagedDataSource for it. but I need pages to enumerated on the .aspx , So I add LinkButtons dynamically to PlaceHolder and Write one Eventhandler for all of them. It shows and works fine. on the first click Eventhandler is fired. on the second it doesn’t fire. on the third it is. and so on… Any Idea?

    protected void Page_Load(object sender, EventArgs e)
    {
        bindrepeater();
    }


    private void bindrepeater()
    {
        var service = new Service();
        var coll = service.GetPeople();

        PagedDataSource Pds1 = new PagedDataSource();
        Pds1.DataSource = coll;
        Pds1.AllowPaging = true;
        Pds1.PageSize = 10;
        Pds1.CurrentPageIndex = CurrentPage;

        Repeater1.DataSource = Pds1;
        Repeater1.DataBind();

        var count = (coll.Count / 10) + 1;
        pages.Controls.Clear();
        for (int i = 1; i < count; i++)
        {
            var lb = new LinkButton() { Text = i.ToString(), CssClass = "hrefia" };
            lb.Click += new EventHandler(lb_Click);
            pages.Controls.Add(lb);
        }
    }

    protected void lb_Click(object sender, EventArgs e)
    {
        var lb = (LinkButton)sender;
        CurrentPage = int.Parse(lb.Text);
        bindrepeater();
    }

    public int CurrentPage
    {
        get
        {
            object s1 = this.ViewState["CurrentPage"];
            if (s1 == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(s1);
            }
        }
        set { this.ViewState["CurrentPage"] = value; }
    }
  • 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-06-08T21:05:11+00:00Added an answer on June 8, 2026 at 9:05 pm

    It was needed to give ID to all of the linkbuttons.
    @Hassan Boutougha ansered me in comments…

    var lb = new LinkButton() { Text = i.ToString(), CssClass = "hrefia" };
    lb = "btnId" + i.ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a friend who is need of a web page. He does interior
I've a Repeater and I need paging, so I'm using PagedDatasource. Given: string tag
i need to reset paging toolbar parameters as page , start , limit when
I have asp.net mvc website and in some pages i need a paging feature,
I need to a scroll paging with jqgrid where I query the database each
I need to execute the less command, with paging, from my Java console application.
Let's say you are designing a web application for internal business use. Should a
I have a web page that returns over 36000 items from sql server and
As need to display Records in grid view in (ASP.NET) web site. and for
I've got an web app in ASP.NET 2.0 in which I need to do

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.