473,586 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window scroll position

Ultimately what I need is a way to remember the scroll position of the form
on a post back. I have a button that posts back to the current form and if
there are no errors the form is reproduced, I want to scroll back to where
the user was when they clicked on the button.

I have an ASPX page with the following doc type:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd" >

I'm not a 100% sure what all the above means, though I do know (from help
with a co-worker) that it determines how the document is generated on the
client side. I have to leave the doc type that way for our standards, but
still need to do the following.

I have the following JAVASCRIPT in the same page:

alert("You've scrolled to " + document.body.s crollTop + " pixels.");

With the doctype tag I always receive 0 for the value, but if I remove the
doctype tag or set it to a different type, I receive the correct value. Is
there an equivalent of scrollTop in the above doc type?

Any help or points in the right direction are appreciated.
Thanks
Wayne
Apr 4 '06 #1
1 2092
I had tried SmartNavigation (replaced with MaintainScrollP ositionOnPostba ck)
before, but for some reason it to does not work. I have a GridView on my
form that is tied to a large dataset (large in 30 or so rows), there are
buttons that are dynamically created and when pressed call a javascript
function. which looks like:

function confirmIt(url)
{
location.href = url;
}

Which now that I think about it, looks more like a redirect then a postback.
This could be why the above doesn't work for me.

I did however find the following on the web:

http://www.howtocreate.co.uk/tutoria.../browserwindow

Last of the sample code shows hot to get the x, y of the scroll and then I
also found

http://www.devhood.com/messages/mess...read_id=104625

Which had:

window.scrollTo (x, y);

This does the trick for me, for now. As I learn more and probably realize
what is wrong with my location.href I'll work on correcting it so I can use
the default property.

Thanks
Wayne

"Steven" <St****@discuss ions.microsoft. com> wrote in message
news:B4******** *************** ***********@mic rosoft.com...
If the users are using IE 5+ then set the DOCUMENT property of
'smartNavigatio n' to true.

"Wayne Sepega" wrote:
Ultimately what I need is a way to remember the scroll position of the
form
on a post back. I have a button that posts back to the current form and
if
there are no errors the form is reproduced, I want to scroll back to
where
the user was when they clicked on the button.

I have an ASPX page with the following doc type:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd" >

I'm not a 100% sure what all the above means, though I do know (from help
with a co-worker) that it determines how the document is generated on the
client side. I have to leave the doc type that way for our standards, but
still need to do the following.

I have the following JAVASCRIPT in the same page:

alert("You've scrolled to " + document.body.s crollTop + " pixels.");

With the doctype tag I always receive 0 for the value, but if I remove
the
doctype tag or set it to a different type, I receive the correct value.
Is
there an equivalent of scrollTop in the above doc type?

Any help or points in the right direction are appreciated.
Thanks
Wayne

Apr 4 '06 #2

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

Similar topics

4
2134
by: Ian Sedwell | last post by:
Hi guys The following code works just fine in Netscape on MacOS and Windows. But in Explorer on MacOS and Windows it throws a type mismatch error at the point marked with the comment ³// bug out at this point². (The functions that are called, but not listed here work fine in both Netscape and Explorer in this and other contexts, so I can...
2
9922
by: abs | last post by:
How to detect that user started to scroll the page ? Separately vertical and horizontal scroll. Is it possible ? Regards, ABS
19
31034
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). The problem is that after the reload, it brings you right to the top of the page. When I click 'refresh" on the original page, it brings me back to...
3
5263
by: Steve | last post by:
I want to force a window to scroll and am finding this to be an impossibly difficult task. First I tried using the API functions ScrollWindow and ScrollWindowEx but they do not work. The portion that is being exposed in the scroll is not painting properly even though I've passed it the flags to tell it to invalidate and erase the new area's...
4
2347
by: libsfan01 | last post by:
hi is it possible to position a div relative to the document window? so for example if the page is scrolled down the div in question does not move regards marc
3
14422
by: superjacent | last post by:
Hope someone can help. I have a listbox displaying time periods in blocks of 15 mins for a 24 hour period, all up 96 rows. The listbox can only visibly show 20 rows a time. The default feature is that the first row is at the top of the listbox.
2
4697
by: sachjn | last post by:
Hi, I need to have a table along with other UI items in page which resizes horizontally and vertically with the browser window. That means table should accoupy the remaining available space in the browser window and should display horizontal and vertical scroll bars if content of table is more than available width & height. I can do similer...
12
7821
Frinavale
by: Frinavale | last post by:
I think I'm trying to do something impossible. I have a <div> element with a overflow style set to "scroll". In other words my <div> element allows the user to scroll the content within it. There are a number of elements within this <div> that cause the <div> to participate in an Ajax call to the server. In order to maintain the scroll...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
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...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6617
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...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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...
0
3838
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...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1184
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...

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.