Maintaining the scroll position and selected control in reverse gear

Back with another web issue.

When the control issues a postback to the server, the page is refreshed (Fine). The page also scrolls back and loses the selected control. If it is relevant after the postback, depending on what changes have occurred, the controls become visible or hidden. Focus is lost and the current scroll is reset even if the page visibility does not change. The data entered in the text fields is saved, as well as any radio / flag selection options. The problem is that tabbing has a reset value for index 0, and page scrolling is sent back to the top of the page.

I am using .Net 4.0

I tried to add MaintainScrollPositionOnPostback = "true" both on the asp page itself and in web.config to no avail. I tried with and without Ajax updatepanel, using a conditional update that starts when the text of the text fields changes or the parameters of the radio exchange change, and postback still causes the scroll and index loss.

Any information would be fantastic. That!

+4
source share
1 answer

First of all, MaintainScrollPositionOnPostback="true" has a known bug in asp.net 2.0, see here .

Also, the correct syntax is maintainScrollPositionOnPostback . (lowercase m)

I used maintainScrollPositionOnPostback , but I have a lot of problems in IE, then I use ASP.NET AJAX Control Toolkit UpdatePanel, it solves the problem (the page does not scroll up) and retains some bandwidth.

EDIT:

I think I understand your problem, it focuses on the element, this can be done with some javascript, se workarounds here .

Hope this helps.

+3
source

Source: https://habr.com/ru/post/1391252/


All Articles