Get the scroll top of a div in asp.net

I have a webpage that has Horizontal Y and vertical X scroll bars I use a JavaScript to stop the screen resetting when the user scrolls down to the bottom of the screen.

How do i stop the resetting when the user scrolls to the right?

In many websites having long contents we have seen a "Back To Top" or "Scroll To Top" button when a click takes you to the top of the webpage. We see this kind of feature normally on the product listing pages of e-Commerce websites. Today in this article we will implement the same feature in one of the easiest possible ways. To integrate this feature, we need a little HTML, some CSS for styling and a couple of lines of jQuery code. Using the following method, you can integrate the “Back To Top” feature on your website irrespective of the programming language of your website, be it ASP.NET or PHP.

To start with, we will create a HTML page with the following content in the section.

  1. Back To Top Demo by Nitesh Luharuka
  • Get the scroll top of a div in asp.net

    Description: Suppose we have to display large content on a page but we have a limited space on page. In this case we can wrap the content in HTML div and by setting its overflow-y to scroll we can add a vertical scrollbar to display all content in the specified div. This solution works fine but whenever a postback occurs on page the div gets back to its original starting position.

    Here in this example, In order to maintain the scrolled position after postback I retained the div scroll value in hiddenfield using jquery and after postback get the scroll value from hiddenfield and set back to div to maintain the scroll position.

    Implementation: Let’s create a sample page from demonstration purpose.

    HTML Source Code