how to keep same position in form after postback?

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

Hi,

I made a form consisting of a lot of server-controls (dropdownlist,
radiobuttonlist ...). Some controls have their property 'autoPostBack' =
true because some things must happen when selectedvalue is changed.

My problem: suppose that the property 'autoPostBack' of 20th control is
true, each time the user changes the selectedvalue, he is sent back to the
top of the form after postback. He has then to scroll down to find the 21th
control.

Is there any way to impede that and to keep the same poition in the form
after postback?

Thanks
Dan
 
Hi,

you can set MaintainScrollPositionOnPostBack="True" to Page directive
(starting in ASP.NET 2.0)
 
There is a property on the Page object in .NET 2.0
MaintainScrollPositionOnPostBack
Set it to true.

Basically when form is submitted JavaScript remembers current scroll
position in hidden variable (input type=hidden).
Then when page comes back from POST scroll position is restored with
JavaScript.


George.
 
Thanks

George Ter-Saakov said:
There is a property on the Page object in .NET 2.0
MaintainScrollPositionOnPostBack
Set it to true.

Basically when form is submitted JavaScript remembers current scroll
position in hidden variable (input type=hidden).
Then when page comes back from POST scroll position is restored with
JavaScript.


George.
 
Back
Top