Solved

Gridview keeping track of previous page number and applying it on new selection showing previous page number.

Posted on 2008-06-17
1
225 Views
Last Modified: 2013-12-16
I have a page that display alphabets A-Z.
[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
when the page loads, it displays data with surname that starts with A. You can click on the other alphabets to display accordingly

1. if  i select "B"  and the number of  pages is  3 on the gridview and i click on page 3,
   I then click on another alphabet "V" that has 3 pages too,my grid shows
   records from page 3 and makes page 3 active. I will have to go and click on page 1
 
   whenever i click on any alphabet i want it to start on page 1 and not
   any other page and page 1 should be the active page not tracking my  
   previous page numbers.


Thanks.

Here is the code handling this. I will post more code as needed.
 
protected void sdgridview_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        try
        {
            //right here
            sdgridview.DataSource = SortDataTable(sdgridview.DataSource as DataTable, true);
            sdgridview.PageIndex = e.NewPageIndex;
            sdgridview.DataBind();                 
        }
        catch (Exception ex)
        {
            Response.Redirect("Error.aspx");
        }
    }

Open in new window

0
Comment
Question by:Sirdots
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 37

Accepted Solution

by:
samtran0331 earned 500 total points
ID: 21809654
when you change letters, I assume you rebind the grid? if yes, when the grid rebinds, try setting PageIndex = 0
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSIS Start 2 37
PowerShell: Why is this variable causing Microsoft.Online.Administration.AccountSkuDetails ? 4 38
Visual Studio npm 1 29
How to repeat the data 4 30
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question