473,749 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3414
Hi,

you can set MaintainScrollP ositionOnPostBa ck="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******** ******@TK2MSFTN GP03.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
MaintainScrollP ositionOnPostBa ck
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******** ******@TK2MSFTN GP03.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******** ******@TK2MSFTN GP03.phx.gbl...
There is a property on the Page object in .NET 2.0
MaintainScrollP ositionOnPostBa ck
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******** ******@TK2MSFTN GP03.phx.gbl...
>Hi,

I made a form consisting of a lot of server-controls (dropdownlist,
radiobuttonlis t ...). 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
6636
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 to its initial position when the user posts back (by clicking a button, etc.) I have all of the fundamentals for asp.net modal dialogs in place, such as using <base target="_self"> in the header... To reiterate the problem for the sake of...
1
7098
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 and I lose the view of my selected row because the datagrid now has the scrollbar repositioned to the top,with datagrid showing the first 70 rows. How can I keep the scrollbar where it was before the postback so that the selected row(which in...
3
2248
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 specific location in a page. Thanks!
5
15975
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. http://www.devhood.com/messages/message_view-2.aspx?thread_id=104625 My question is : can the same thing be done to restore the scroll position of a specific DIV within a page? I have a DIV section which scrolls independently to the page : <div style="vertical-align: top; height:200px;...
2
1958
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
1733
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 entries, I mean, more than fits on one page. The user will then scroll down and click on 'edit'. After the roundtrip he has to scroll down again in order to see the row in the editable state. Is there a way to keep the row's position and scroll...
3
6075
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 postback), the scroll position resets to the top. I was unable to figure out how to not force a postback or how to reset the scroll position of the GridView. What are my options here?
2
2495
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 <div> could retain its scroll position after postback?
0
1838
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 "file". That mean I create server file upload controls in this page. After user choose their files, wanted to upload, and click upload button, this page will be postbacked to another page, called "edit.aspx". The code as follows. edit.aspx
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.