Reset scroll position after Async postback – ASP.NET

As you’re using UpdatePanels you’re going to need to hook into the ASP.NET AJAX PageRequestManager You’ll need to add a method to the endRequest event hooks that are: Raised after an asynchronous postback is finished and control has been returned to the browser. So you’d have something like: <script type=”text/javascript”> Sys.WebForms.PageRequestManager.getInstance().add_endRequest(pageLoaded); function pageLoaded(sender, args) { … Read more

Maintain/Save/Restore scroll position when returning to a ListView

Parcelable state; @Override public void onPause() { // Save ListView state @ onPause Log.d(TAG, “saving listview state”); state = listView.onSaveInstanceState(); super.onPause(); } … @Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // Set new items listView.setAdapter(adapter); … // Restore previous state (including selected item index and scroll position) if(state != null) { … Read more