Solved

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

Posted on 2008-06-17
1
222 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now