473,382 Members | 1,447 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,382 software developers and data experts.

Server-side controls repositing long client forms to top

Whenever an ASP.NET server-side control is processed, the client form is
repainted from the top forcing users to scroll back to where they were on
long forms. How can I work around this issue?

For example run this, scroll down and click the left check box:

<%@ Page Language=vb %>
<html>
<script runat=server>
Sub Test(ByVal sender As System.Object, ByVal e As System.EventArgs)
Box2.Checked = Box1.Checked
End Sub
</script>

<body>
<form id="Form1" method="post" runat="server">
<TABLE>
<TR><TD height=1500 bgcolor=red></TD></TR>
<TR>
<TD>
<asp:CheckBox id=Box1 runat="server" AutoPostBack=True
OnCheckedChanged=Test></asp:CheckBox>
</TD><TD>
<asp:CheckBox id=Box2 runat="server"></asp:CheckBox>
</TD>
</TR>
</TABLE>
</form>
</body>
</html>
Sep 7 '07 #1
4 1698
Just set the MaintainScrollPositionOnPostback directive to True, either on
the page-level or in Web.config if you want it to apply to all pages in the
website. For a single page, update the <% @Page directive so that it looks
lkike:

<%@ Page Language="..." MaintainScrollPositionOnPostback="true" ... %>
To apply the setting to all pages in the website, add the following to the
Web.config file (within the <system.webelement):

<pages maintainScrollPositionOnPostBack="true" />
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Networxpro" wrote:
Whenever an ASP.NET server-side control is processed, the client form is
repainted from the top forcing users to scroll back to where they were on
long forms. How can I work around this issue?

For example run this, scroll down and click the left check box:

<%@ Page Language=vb %>
<html>
<script runat=server>
Sub Test(ByVal sender As System.Object, ByVal e As System.EventArgs)
Box2.Checked = Box1.Checked
End Sub
</script>

<body>
<form id="Form1" method="post" runat="server">
<TABLE>
<TR><TD height=1500 bgcolor=red></TD></TR>
<TR>
<TD>
<asp:CheckBox id=Box1 runat="server" AutoPostBack=True
OnCheckedChanged=Test></asp:CheckBox>
</TD><TD>
<asp:CheckBox id=Box2 runat="server"></asp:CheckBox>
</TD>
</TR>
</TABLE>
</form>
</body>
</html>
Sep 7 '07 #2
Thanks, but unfortunately this site is running .NET Framework 1.1 and
MaintainScrollPositionOnPostback is new in 2.0

Any other suggestions?

"Peter Bromberg [C# MVP]" wrote:
Just set the MaintainScrollPositionOnPostback directive to True, either on
the page-level or in Web.config if you want it to apply to all pages in the
website. For a single page, update the <% @Page directive so that it looks
lkike:

<%@ Page Language="..." MaintainScrollPositionOnPostback="true" ... %>
To apply the setting to all pages in the website, add the following to the
Web.config file (within the <system.webelement):

<pages maintainScrollPositionOnPostBack="true" />
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Networxpro" wrote:
Whenever an ASP.NET server-side control is processed, the client form is
repainted from the top forcing users to scroll back to where they were on
long forms. How can I work around this issue?

For example run this, scroll down and click the left check box:

<%@ Page Language=vb %>
<html>
<script runat=server>
Sub Test(ByVal sender As System.Object, ByVal e As System.EventArgs)
Box2.Checked = Box1.Checked
End Sub
</script>

<body>
<form id="Form1" method="post" runat="server">
<TABLE>
<TR><TD height=1500 bgcolor=red></TD></TR>
<TR>
<TD>
<asp:CheckBox id=Box1 runat="server" AutoPostBack=True
OnCheckedChanged=Test></asp:CheckBox>
</TD><TD>
<asp:CheckBox id=Box2 runat="server"></asp:CheckBox>
</TD>
</TR>
</TABLE>
</form>
</body>
</html>
Sep 7 '07 #3
just do the same logic. in clientscript, in onsubmit, store the x & y in
a hidden fields. then on postback render if x & y are filled in, render
client script to set the scroll position.

-- bruce (sqlwork.com)

Networxpro wrote:
Thanks, but unfortunately this site is running .NET Framework 1.1 and
MaintainScrollPositionOnPostback is new in 2.0

Any other suggestions?

"Peter Bromberg [C# MVP]" wrote:
>Just set the MaintainScrollPositionOnPostback directive to True, either on
the page-level or in Web.config if you want it to apply to all pages in the
website. For a single page, update the <% @Page directive so that it looks
lkike:

<%@ Page Language="..." MaintainScrollPositionOnPostback="true" ... %>
To apply the setting to all pages in the website, add the following to the
Web.config file (within the <system.webelement):

<pages maintainScrollPositionOnPostBack="true" />
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Networxpro" wrote:
>>Whenever an ASP.NET server-side control is processed, the client form is
repainted from the top forcing users to scroll back to where they were on
long forms. How can I work around this issue?

For example run this, scroll down and click the left check box:

<%@ Page Language=vb %>
<html>
<script runat=server>
Sub Test(ByVal sender As System.Object, ByVal e As System.EventArgs)
Box2.Checked = Box1.Checked
End Sub
</script>

<body>
<form id="Form1" method="post" runat="server">
<TABLE>
<TR><TD height=1500 bgcolor=red></TD></TR>
<TR>
<TD>
<asp:CheckBox id=Box1 runat="server" AutoPostBack=True
OnCheckedChanged=Test></asp:CheckBox>
</TD><TD>
<asp:CheckBox id=Box2 runat="server"></asp:CheckBox>
</TD>
</TR>
</TABLE>
</form>
</body>
</html>
Sep 7 '07 #4
Thanks Bruce & Peter.

Your tips and a search led me to a couple of simple solutions that I can
easily apply to our various webforms:

Steve Stchur's "Maintaining Scroll Position on Postback"
http://aspnet.4guysfromrolla.com/articles/111704-1.aspx

Ibrahim Uludag's "Crossbrowser SmartNavigation Alternatives"
http://www.codeproject.com/aspnet/lili2.asp

Thanks for the help!
Networxpro

"bruce barker" wrote:
just do the same logic. in clientscript, in onsubmit, store the x & y in
a hidden fields. then on postback render if x & y are filled in, render
client script to set the scroll position.

-- bruce (sqlwork.com)

Networxpro wrote:
Thanks, but unfortunately this site is running .NET Framework 1.1 and
MaintainScrollPositionOnPostback is new in 2.0

Any other suggestions?

"Peter Bromberg [C# MVP]" wrote:
Just set the MaintainScrollPositionOnPostback directive to True, either on
the page-level or in Web.config if you want it to apply to all pages in the
website. For a single page, update the <% @Page directive so that it looks
lkike:

<%@ Page Language="..." MaintainScrollPositionOnPostback="true" ... %>
To apply the setting to all pages in the website, add the following to the
Web.config file (within the <system.webelement):

<pages maintainScrollPositionOnPostBack="true" />
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Networxpro" wrote:

Whenever an ASP.NET server-side control is processed, the client form is
repainted from the top forcing users to scroll back to where they were on
long forms. How can I work around this issue?

For example run this, scroll down and click the left check box:

<%@ Page Language=vb %>
<html>
<script runat=server>
Sub Test(ByVal sender As System.Object, ByVal e As System.EventArgs)
Box2.Checked = Box1.Checked
End Sub
</script>

<body>
<form id="Form1" method="post" runat="server">
<TABLE>
<TR><TD height=1500 bgcolor=red></TD></TR>
<TR>
<TD>
<asp:CheckBox id=Box1 runat="server" AutoPostBack=True
OnCheckedChanged=Test></asp:CheckBox>
</TD><TD>
<asp:CheckBox id=Box2 runat="server"></asp:CheckBox>
</TD>
</TR>
</TABLE>
</form>
</body>
</html>
Sep 8 '07 #5

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

Similar topics

2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
0
by: Philip Trim | last post by:
General Brief: 3 SQL Servers as MS SQL Server 2000 Standard Edition with Service Pack 3 All using FTP for snapshots All Servers are both Publishers and Distributors. Server A has the correct...
5
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
2
by: Jay Chan | last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that has Windows-2003 Server on it. Now, we cannot get access to that database server from other computers. Seem like this may be an...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
4
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
10
by: sara | last post by:
Hi All, I was able to connect to MS SQL Server 2005 on my computer but after a while I can not. When I want to connect to it using MS SQL Server Management Studio I got this error: An error...
1
by: manish deshpande | last post by:
Hi, When i'm installing MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm by the following command: rpm -i MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm the following error is being shown: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.