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

  • Home
  • SEARCH
  • 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 8806687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:11:13+00:00 2026-06-14T02:11:13+00:00

I have gridview with multiple pages of records in a.aspx. When I click a

  • 0

I have gridview with multiple pages of records in a.aspx.
When I click a button in b.aspx I need to go to a specific page that contains the record in the gridview.

  • 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-14T02:11:16+00:00Added an answer on June 14, 2026 at 2:11 am

    I assume that you actually want to go to a specific record instead. Then i would pass it’s ID via url-parameter (or session) and then go to the page in the grid with this record. That’s is better because the page might change(f.e. with sorting).

    Assuming that your grid lists products and you want to ensure that a perticular product is shown because you’ve just edited the product-details on another page. Also assuming that your DataSource is a DataTable(but it doesn’t really matter):

    /// <summary>
    /// Binds the products-GridView.
    /// </summary>
    /// <param name="ProductID">the ProductID to be displayed, changes also the PageIndex if necessary</param>
    private void BindProductGrid(int ProductID = -1)
    {
        DataTable tblProducts = getAllProducts();
        GridProducts.DataSource = tblProducts;
        bool needsPaging = (tblProducts.Rows.Count / GridProducts.PageSize) > 1;
    
        if (ProductID == -1)
        {
            this.GridProducts.PageIndex = 0;
            this.GridProducts.SelectedIndex = -1;
        }
        else
        {
            int selectedIndex = tblProducts.AsEnumerable()
                .Select((Row, Index) => new { Row, Index })
                .Single(x => x.Row.Field<int>("ProductID") == ProductID).Index;
            int pageIndexofSelectedRow = (int)(Math.Floor(1.0 * selectedIndex / GridProducts.PageSize));
            GridProducts.PageIndex = pageIndexofSelectedRow;
            GridProducts.SelectedIndex = (int)(GridProducts.PageIndex == pageIndexofSelectedRow ? selectedIndex % GridProducts.PageSize : -1);
        }
        GridProducts.DataBind();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple subdirectories in my solution that have default.aspx pages in them, so
I have two GridView s in my Page which contains multiple items. One is
I have a gridview control that can get loaded with multiple pages worth of
I have a gridview with multiple rows, each has a Update button and I
I have GridView on my page: <%@ Page Language=C# AutoEventWireup=true CodeFile=Default.aspx.cs Inherits=_Default %> <!DOCTYPE
I have a master-detail page, in which I use GridView to display multiple rows
I have a gridview and binding the records in it from a list.I need
I have got a button field in my grid view. When I click multiple
I have a gridview that is inflated by multiple buttons. I used just a
I have a page with multiple DevExpress gridviews which are late-loaded via ajax. The

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.