简体   繁体   中英

Keep scroll position after Postback - 2019

Before I expose my problem, let me explain the reason why I ask this question again, after all others have been answered.

Short answer:

None of those worked for me.

Long answer:

I've been searching this topic, for over 1 year already and still got this problem unresolved.

  • I've tried javascript "solutions", a lot of them really, none have worked;
  • I've tried the MaintainScrollPositionOnPostback="true" directive, in Masterpage and in Webconfig as well;
  • I've tried the Page.SmartNavigation (which is obsolete) as well, and again nothing;
  • I've tried countless "solutions" to no avail;

I use a Masterpage and UpdatePanels in every Contentpage .

So it's starting to get annoying not being able to resolve this.

I've read somewhere that the MaintainScrollPositionOnPostback property no longer works with any of the browsers, but I might have misread that.

I'd appreciate your help :)!

Best regards!

For future reference.

My problem resided in the code itself, using Control.Focus() " conflits " with the Scroll position.

As @GaganDeep helpfully explained, one cannot use Control.Focus() and MaintainScrollPositionOnPostback="true" and the same time, as the Focus() Scrolls the page to the position of the referenced Control.

Thank you for your help! I was really struggling with this one, never thought it could be such a " simple " thing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM