Set Page Position to Default after asyncPostback in AJAX
Posted by Virendra Dugar on January 20, 2010
I will start this article, with one of the problem which I come across recently.
There were more than 10000 records listed in the repeater. When I click the very last record for editing, asynchronous postback happens and data is loaded for editing in Area 1 . But the problem was with the page position. I was not able to see the control’s of Part1, as page was maintaining it’s scroll position after async postback. This is what I don’t want. As it’s not at all user friendly. End-User will never come to know that record has been opened in edit mode. I set the “MaintainScrollPositionOnPostback” property to false but it was not working due to AJAX. Somehow, I want page position to be set to (0,0) so that I can see Area 1 controls.
The solution was to set Page position back to 0,0, at the end of ajax request. Here is what I did. See below code.