Maintain scroll position in listboxes in updatepanels, NOT the page

后端 未结 5 1794
臣服心动
臣服心动 2020-12-05 21:38

I have a listbox inside an update panel. When I scroll down and select an item, it scrolls back to the top of the listbox. I heard that the dom does not keep track of the

5条回答
  •  伪装坚强ぢ
    2020-12-05 22:16

    For the enterprise application I was working on, it turned out that the MasterPage.Master page was handling the Sys.WebForms.PageRequestManager.getInstance().add_endRequest event and setting window.scroll(0,0) within it. The content pages were obviously executing the window.scroll(0,0) on each trigger of the contentpage's UpdatePanel. I tried overriding the add_endRequest functionality in the content page but could not get that to work. Eventually I just modified the Master.Master to not do window.scroll(0,0).

提交回复
热议问题