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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:43:22+00:00 2026-05-24T23:43:22+00:00

Hi all i have a page that takes items from a sql datasource and

  • 0

Hi all i have a page that takes items from a sql datasource and puts them into a repeater. I want to know how to change the page index of the pagedDatasource when i click another button

page load

    DataSourceSelectArguments arg = new DataSourceSelectArguments();

    arg.MaximumRows = 8;
    arg.AddSupportedCapabilities(DataSourceCapabilities.Page);



    DataView set = (DataView)SQLDataSourceProducts.Select(arg);
    int rows = arg.TotalRowCount;
    PagedDataSource paged = new PagedDataSource();
    paged.DataSource = set;
    paged.AllowPaging = true;
    paged.PageSize = 3;
    int pageIndex = 1;
    paged.CurrentPageIndex = pageIndex - 1;

    RepeaterProducts.DataSource = paged;
    RepeaterProducts.DataBind();

On a button press

protected void moreButton_Click(object sender, EventArgs e)
{
    //Change the pageIndex 

}

Thanks all

  • 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-24T23:43:23+00:00Added an answer on May 24, 2026 at 11:43 pm

    Hi all found the answer and this is how i done it for anyone who wants to know

    public void popRepeater()
    {
        //Clear datasource so you can repopulate without getting duplication error 
        SQLDataSourceProducts.SelectParameters.Clear();
    
        //Your query
        SQLDataSourceProducts.SelectParameters.Add
    
    
        DataSourceSelectArguments arg = new DataSourceSelectArguments();
    
        arg.MaximumRows = 8;
        arg.AddSupportedCapabilities(DataSourceCapabilities.Page);
    
    
    
        DataView set = (DataView)SQLDataSourceProducts.Select(arg);
        int rows = arg.TotalRowCount;
        PagedDataSource paged = new PagedDataSource();
    
        paged.DataSource = set;
        paged.AllowPaging = true;
        paged.PageSize = 3;
        //int pageIndex = 1;
        paged.CurrentPageIndex = CurrentPage ;
    
        RepeaterProducts.DataSource = paged;
        RepeaterProducts.DataBind();
    }
    
    public int CurrentPage
    {
        get
        {
            // look for current page in ViewState
            object o = this.ViewState["_CurrentPage"];
            if (o == null)
                return 0; // default page index of 0
            else
                return (int)o;
        }
    
        set
        {
            this.ViewState["_CurrentPage"] = value;
        }
    } 
    
    protected void moreButton_Click(object sender, EventArgs e)
    {
    
        CurrentPage += 1;
        popRepeater();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an intermediary class extending System.Web.UI.Page for all of my pages that require
I have a master page which all my views inherit from. The issue I
I have a query that running way too slow. the page takes a few
I have a page where I want to list all of the documents a
I have a method that takes a System.Web.UI.Page as an input and returns some
I have web page in PHP which displays all records in a table. I
I have a page (page1.html) which references a css file (style1.css) All is good.
I have an ASP.net master page. In this master, I have all my css
How to find all files in directory? I have HTML page in some directory.
I have one master page which applies to all pages in this website. On

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.