473,322 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

how to keep same position in form after postback?

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
Jun 27 '08 #1
3 3397
Hi,

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

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

"Dan" <d@ny.nlwrote in message
news:uq**************@TK2MSFTNGP03.phx.gbl...
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

Jun 27 '08 #2
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.
"Dan" <d@ny.nlwrote in message
news:uq**************@TK2MSFTNGP03.phx.gbl...
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

Jun 27 '08 #3
Dan
Thanks

"George Ter-Saakov" <gt****@cardone.comschreef in bericht
news:es**************@TK2MSFTNGP03.phx.gbl...
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.
"Dan" <d@ny.nlwrote in message
news:uq**************@TK2MSFTNGP03.phx.gbl...
>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


Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rod | last post by:
I have an asp.net application where some of the interaction with the user is through modal dialog windows. This works very well except for the annoying fact that the dialog window always returns...
1
by: deepika | last post by:
Hi, I have a datagrid with 200 rows and an iframe adjacent to it. When I click on the row, the details of that row show up in the iframe. Now suppose I click on the 150th row, the postback occurs...
3
by: Steve Covert | last post by:
In the case of a long Webform, when a PostBack event occurrs, is there a technique to position the Form at where it was when the event fired? Similar to using an anchor tag in html to go to a...
5
by: JezB | last post by:
There are a few references on the net about how to restore a page's scroll position over a postback. This is a simple one which works for me: eg....
2
by: Green | last post by:
hi, I had a listbox web control, i want to keep the scrollbar position after postback. Is any way to do that? Thanks very much.
2
by: Carlo Marchesoni | last post by:
I have an editable Datagrid and memorize its datasource with a Session variable. On each Page_Load I simply Bind the Datagrid. Everything works fine. The problem comes, when I have a lot of...
3
by: rmunson8 | last post by:
I have added Panel control to a web page which contains a GridView. The Panel's ScrollBars property is set to auto. When I select the Select CommanField button for a row (which obviously causes a...
2
by: parm | last post by:
I have a <div> with Overflow = Auto and within it have several controls that can cause postback. The problem is that after every postback, the <div> would scroll back top. Is there a way that the...
0
JimWu
by: JimWu | last post by:
I have some problems in my code. The stutiation illustrate as the followsing statement. I use two pages, one, named "upload.aspx", is including several general html input tag, whose type are...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.