Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

how to keep same position in form after postback?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan - 22 May 2008 19:16 GMT
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
Teemu Keiski - 22 May 2008 19:38 GMT
Hi,

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

Signature

Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

> Hi,
>
[quoted text clipped - 12 lines]
> Thanks
> Dan
George Ter-Saakov - 22 May 2008 19:47 GMT
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.

> Hi,
>
[quoted text clipped - 12 lines]
> Thanks
> Dan
Dan - 22 May 2008 20:14 GMT
Thanks

> There is a property on the Page object in .NET 2.0
> MaintainScrollPositionOnPostBack
[quoted text clipped - 23 lines]
>> Thanks
>> Dan

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.