2

I have many controls in my page and some controls have auto post back property. when i use that control post-back occurs so page position becomes top.

I need to maintain same position and focus on next control. I have googled about this but I got solution separately for page position and focus like

MaintainScrollPositionOnPostback="true"

txtbox.Focus()

But it dint work.

Vignesh Kumar A
  • 27,863
  • 13
  • 63
  • 115

2 Answers2

3

It seems like you are setting the attribute from some codebehind. I would suggest you set it as a page directive in the top of your .aspx file like so:

  <%@ Page MaintainScrollPositionOnPostback="true" %>

This way you can be sure the property is always set before the page has rendered.
Please be aware that if you use master pages you should set this property in the masterpage instead.

Also note that this feature is not supported in all browsers. In the case you have trouble with Mozilla Firefox, here is a question similar to yours: MaintainScrollPositionOnPostback property doesn't works with mozilla

Community
  • 1
  • 1
Mellow
  • 701
  • 6
  • 14
1

The reason why yours did not work is because you have the True in quotes. It should look like this:

MaintainScrollPositionOnPostback = True