how to keep same position in form after postback?

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
 
T

Teemu Keiski

Hi,

you can set MaintainScrollPositionOnPostBack="True" to Page directive
(starting in ASP.NET 2.0)
 
G

George Ter-Saakov

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.
 
D

Dan

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top