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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:20:04+00:00 2026-06-01T03:20:04+00:00

I have an issue with maintaining scroll position. I am almost positive that I

  • 0

I have an issue with maintaining scroll position.

I am almost positive that I have everything set correctly. I have updated my web config…

<pages maintainScrollPositionOnPostBack="true"

and everything seems to work fine UNTIL….

When ever my Gridview returns a lot of pages, like more than 50, sometimes upwards of 100 or more, I show 50 records per page. The farther into the Gridview, the more the scroll position is off.

So what I am saying is that for the first 20 plus pages or so, if I scroll down the page to the point where the top rows have moved off the screen and I enter Edit Mode, the correct record remains in view on Postback.

But if I am over say around 30 pages into the Gridview, the further in the worse it gets, when i enter Edit Mode I have to scroll back down to the location of the record that I selected to edit.

Any ideas on this one will be tested, my users are going nutts!!!

thanks again,

  • 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-01T03:20:05+00:00Added an answer on June 1, 2026 at 3:20 am

    You could wrap the gridview in a div set with overflow:auto. Then with js reset the scroll position when the page loads. something like this.

    <body onload="GetDivPosition()">
    <form id="form1" runat="server">
    
    <asp:HiddenField ID="hdnField" runat="server" Value="0" />
    
    <div style="overflow:auto;" ID="gridArea" onscroll="SetDivPosition()">
    
    <asp:GridView ID="yourGrid" runat="server">
          .....
    </asp:GridView>
    
    </div>
    
    
    <script language="javascript" type="text/javascript">
    
            function GetDivPosition() {
                var hdn = document.getElementById("hdnField");
                document.getElementById("gridArea").scrollTop = hdn.value;
            }
    
            function SetDivPosition() {
                var hdn = document.getElementById("hdnField");
                hdn.value = document.getElementById("gridArea").scrollTop;
            }
    </script>
    

    Visual studio will probably give you warnings that onscroll isn’t valid but it has always worked for me. If your using an update panel it’s a little more complicated. Actually all of mine are in update panels so I tried to revert this code back, so hopefully this will work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue that is driving me a bit nuts: Using a UserProfileManager
I have an issue with watin test that should browse for pdf and upload
I have the task of maintaining an application that started life as a VB6
I have a web-site that generates some simple tabular data as html tables, many
I'm having some issues with maintaining scroll bar locations. The Background I have a
We have an issue using the PEAR libraries on Windows from PHP . Pear
We have an issue related to a Java application running under a (rather old)
We have an issue on our page whereby the first time a button posts
I have some issue with a Perl script. It modifies the content of a

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.