Browser flicks to top of page on post back

M

McGeeky

On a post back, Internet Explorer flicks the page to the top. E.g. when
scrolling down the page to edit a text box the user clicks a button to
validate the value. This causes a post back. IE then reloads the page but
flicks it back up to the top. The user than has to scroll back down to where
they were.

Is there any way to overcome this behaviour but still use post back?

Thanks.
 
M

Marina Levit [MVP]

You can turn on smart navigation on the page. However, that has been known
to cause side effects, so just a warning.
 
M

Mark Rae

On a post back, Internet Explorer flicks the page to the top. E.g. when
scrolling down the page to edit a text box the user clicks a button to
validate the value. This causes a post back. IE then reloads the page but
flicks it back up to the top. The user than has to scroll back down to
where they were.

Is there any way to overcome this behaviour but still use post back?

Presumably your causing a postback because the contents of the textbox need
to be evaluated server-side e.g. maybe against a database etc...? If so,
then you have several options:

1) Use SmartNavigation - can sometimes have unpredictable results...

2) Use Ajax - probably a sledgehammer to crack a nut...

3) Set the focus to the textbox at the very end of the validation routine -
very easy...
 
J

Jim Cheshire

On a post back, Internet Explorer flicks the page to the top. E.g. when
scrolling down the page to edit a text box the user clicks a button to
validate the value. This causes a post back. IE then reloads the page but
flicks it back up to the top. The user than has to scroll back down to where
they were.

Is there any way to overcome this behaviour but still use post back?

Thanks.

If you're using ASP.NET 2.0, you should use MaintainScrollPosition.

Jim Cheshire
Blog: http://blogs.msdn.com/jamesche
 

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

Top