Keeping Scroll Position over post Backs
page 1 of 3
Published: 20 Jan 2004
Unedited - Community Contributed
Abstract
Ever got one of those long pages that you wanted to retain the scroll position for that much needed post back? Justin Lovell has worked out an all-browser solution to the problem.
by Justin Lovell
Feedback
Average Rating: 
Views (Total / Last 10 Days): 133168/ 379

Introduction

(Update: The StaticScrollBackPosition control has got a few extra "features" added to it. The entire article has been revised to reflect on the changes. )

(Note: You may download the control at the very last page of this article)

When your page does a post-back to the web server, we sometimes need to persist the scroll position where the user was before the post back began. If this sounds like your need for your application, I have developed the server control to solve your problem.

There is a built-in feature (in the .NET Framework) for keeping the scroll position of the user (and also other useful features), called smart navigation. However, this built-in feature posses two problems that my server control (I named it StaticScrollBackPosition) overcomes:

  • Smart navigation can only be used by Internet Explorer 5+. StaticScrollBackPosition caters for majority of browsers:

    • Internet Explorer 4 +

    • Netscape 4 +

    • Opera 7 + (possibly lower versions as well)

    • Mozilla 1 + (possibly lower versions as well)

  • Under smart navigation, the formatting of the pages from post back can go tremendously wrong; if the styling of the page is a mixed breed of CSS and HTML tags.

To use the server control, it is as simple as dropping it in a web form (must be under the server side <form>). However, I am going to explain the few tricks that I used in creating the server control.

The basic idea behind the StaticScrollBackPosition control is that it will not output any user interface – it will only use JavaScript to do all the work for us. The major tricks are:

  1. As the user "views" the page, the scrolled position is constantly recorded to the hidden fields that StaticScrollBackPosition provided.

  2. Back to the server processing, StaticScrollBackPosition will then capture the positions that was placed in the hidden fields and then send a JavaScript block telling the browser where to scroll to once the page has loaded.

  3. And so the cycle will continue from step one after each post-back.

It is that simple. And to make things sound even more simpler, is the fact that the JavaScript has an extremely small size.


View Entire Article

User Comments

Title: test   
Name: test
Date: 1/18/2011 4:26:27 PM
Comment:
Title: Not working in IE
Name: Ginu Mathai
Date: 3/5/2010 12:24:02 AM
Comment:
its not working in IE. So I made a small modification.

private const string ScriptGetPositionLine = ScriptHiddenField +
" = (navigator.appName == 'Netscape') ? window.page{1}Offset : ((document.body.parentElement) ? document.body.parentElement.scroll{2} :document.body.scroll{2});";
Title: With Update Panel   
Name: Mr .Shah
Date: 7/28/2010 8:38:29 AM
Comment:
Is this work where update panel is used ?????
Title: JSP / JAVA   
Name: peeter
Date: 4/7/2010 4:32:35 PM
Comment:
What are the changes I need to make for making it work in JSP.
Title: Not working in IE   
Name: Ginu Mathai
Date: 3/5/2010 12:24:02 AM
Comment:
its not working in IE. So I made a small modification.

private const string ScriptGetPositionLine = ScriptHiddenField +
" = (navigator.appName == 'Netscape') ? window.page{1}Offset : ((document.body.parentElement) ? document.body.parentElement.scroll{2} :document.body.scroll{2});";
Title: It works!   
Name: ganck
Date: 11/24/2009 12:15:36 AM
Comment:
I'm using Visual Studio 2003 and it works for me.
Thank you so much. [24-11-2009]
Title: Software Dev   
Name: Kevin Smith
Date: 8/25/2009 2:08:30 PM
Comment:
Sweet, finally, just what i was looking for, MS smartnavigation and maintainpositiononpostback were giving me endless javascript issues, you're works perfectly, thankyou!
Title: Didn't work for me   
Name: Chip J
Date: 1/28/2009 9:52:41 AM
Comment:
Not sure why this control didn't work for me, but MaintainScrollPositionOnPostBack = True did. Thanks for the effort.
Title: Awsome!   
Name: Steve R
Date: 11/6/2008 3:55:38 PM
Comment:
This is great, I've added it to my arsenal of weapons.
Title: nice job   
Name: nice job
Date: 10/21/2008 8:50:47 AM
Comment:
simple is the key, nice tool. lol to those saying it doesnt work and pitty would have been nice, you's may need to start w/ an asp primer before implementing custom controls to get the feel for proper implementation
Title: thank   
Name: danai
Date: 10/17/2008 1:03:39 PM
Comment:
thanks a lot...
Title: quick loans   
Name: quick loans
Date: 10/8/2008 11:03:22 AM
Comment:
can't get it to work on postback. works fine if i just set the scroll value myself.
Title: nice article   
Name: nn
Date: 6/27/2008 12:46:36 AM
Comment:
well done and very useful code...
thanks a lot...
Title: great yar , great   
Name: rajiv
Date: 5/8/2008 6:42:01 AM
Comment:
keep it up
Title: great!   
Name: uj
Date: 4/29/2008 6:02:10 PM
Comment:
thanks a lot! usage is simple and it works great!!
Title: Doesn't Work   
Name: Sean
Date: 10/29/2007 1:32:42 PM
Comment:
It's unfortunate, this doesn't work at all. Just does nothing. Would have been nice.
Title: Requirements   
Name: Patrice
Date: 9/2/2007 2:48:49 PM
Comment:
Can anyone tell me, please, if this requires sharepoint services? I'm getting a "resource cannot be found" error.

Thank you!
Title: Wow!   
Name: Chris
Date: 8/29/2007 12:39:48 AM
Comment:
I used this control on my personal website. It works great. Not to mention it was easy to setup. It takes a true programmer to come up with such a tool. I hope I can learn how to do that someday.
Title: You are the man   
Name: Manoochehr
Date: 8/8/2007 4:48:42 AM
Comment:
Hey thanks . I was mixed up with this issue but you solved it easily . you are the man . I like you
Title: MaintainScrollPositionOnPostBack   
Name: GD
Date: 7/26/2007 8:33:10 AM
Comment:
MaintainScrollPositionOnPostBack = True

does everythign the convoluted javascript alternatives do!
Title: Mr.   
Name: Faraz
Date: 5/24/2007 8:29:33 AM
Comment:
It's not working if the button is inside usercontrol(ascx) neither does MaintainScrollPositionOnPostback. any idea?
Title: Works like a charm   
Name: Kirit Raja
Date: 5/22/2007 10:33:02 AM
Comment:
It works like a charm. It resolved my long standing issue. Thanks a lot.
Title: Thanks   
Name: Juan Francisco (juan.espin@yahoo.com)
Date: 3/30/2007 5:10:55 PM
Comment:
Tahnks a lot for your code.

If I can help you in anything, please contact me

Best Regards
Title: thanks   
Name: sam
Date: 3/29/2007 2:14:04 AM
Comment:
i like this artical
Title: PHP apache   
Name: Nico van de Kamp
Date: 2/2/2007 5:37:26 AM
Comment:
I don't understand it completely but I need de server control's binary? But I saw there are DLL's in it. So is this solution only available for IIServer?

By the way I have some input fields on the document and then a long record list set, positioned with a div. Somebody can choose a record by double clicking on it. After double clicking on a record the document is submitted to the server.

Can someone help me?

Thanks in advance?
Title: SmartNavigation without your Control !!!!!!   
Name: Abdulla Hussein
Date: 1/29/2007 3:30:30 AM
Comment:
Hi , There is a line code that can do the smartNavigation without using your serverControl
just write the following code in the page_Load

Me.MaintainScrollPositionOnPostBack = True

Please if you see this reply tell me if my code does not work in some diffrent browsers :-)
Title: This is the Greatest!!!!   
Name: Tuong Do
Date: 12/27/2006 11:55:47 AM
Comment:
This is a great control that works perfectly!!! I spent hours looking something that would work!!
Title: Worthless   
Name: Josh
Date: 12/22/2006 12:26:16 PM
Comment:
This doesnt work. Do not waste your time, becuase this guy has a function called on the Onload of the window that sets scroll to 0,0 every time. This is worthless!
Title: Thanks   
Name: Ananya
Date: 12/14/2006 3:55:36 AM
Comment:
Thanks a ton for providing solution.
Title: is it coz i m using asp 2..0   
Name: aman
Date: 11/10/2006 8:22:04 AM
Comment:
referring to the above comment is it coz I am doing that in asp 2.0

is there a simpler way to do it in asp .net 2.0
Title: does not work in IE   
Name: aman
Date: 11/10/2006 8:15:19 AM
Comment:
I got the code working

I have put it in the master page of my project

I copied the dll from therelease folder

problem is

it works with firefox
but doesn't work with IE

can you please tell me the solution
Title: Thanks a lot !   
Name: Cyrille
Date: 10/30/2006 7:45:49 AM
Comment:
It's simple and efficient... I needed to make editable a huge table and it work perfectly...

Brilliant!
Title: Keeping Scroll Position over post Backs   
Name: Ted Green
Date: 10/17/2006 11:39:42 AM
Comment:
It Works! simple and sweet! Thanks very much.
Title: Awesome   
Name: Chad
Date: 9/25/2006 5:08:11 PM
Comment:
Thanks a million. I was pulling my hair out trying to fix the postback issue. This fixed it.
Title: Re: Problems with master pages in ASP.NET 2.0   
Name: Tomasz Saluszewski
Date: 9/11/2006 10:23:51 AM
Comment:
I've slightly modified the control described in http://aspnet.4guysfromrolla.com/articles/111704-1.aspx and it worked (both IE and Safari)!
The only thing I had to do to overcome 'master pages' problem was to chamge the way aspnet form is located in javascript. Here is the code:
var aspForm = document.forms['aspnetForm'];
if (!aspForm) {
aspForm = document.aspnetForm;
}
Title: Problems with master pages in ASP.NET 2.0   
Name: Tomasz Saluszewski
Date: 9/1/2006 3:42:34 AM
Comment:
I am having a problem using Your control in my ASP.NET 2.0 web pages. I suspect it's due I am using master pages. I've tried placing the control in both master and content page, but neither worked. Any ideas?

p.s.
I cannot use ASP.NET 2.0 MaintainScrollPosition page attribute as it doesn't work in Safari, which I need to support.
Title: Great Stuff   
Name: David Ross
Date: 8/31/2006 7:25:28 AM
Comment:
Absolutely Superb. Well done

It worked like a dream and only two lines of code for me!
Title: Thank you very much for your help   
Name: Fedor
Date: 8/22/2006 7:22:49 AM
Comment:
Thank you for solving this annoying problem of losing scroll position at postback. This gives me a lot more freedom of choosing a long data entry form instead of having to cut it up, divide it over several webforms, or hide portions of it...

Thanks again!
Title: Thanks   
Name: Amit
Date: 8/14/2006 8:05:02 AM
Comment:
Thanks...My problem has been solved.
May you live long.
Title: Developer community inc   
Name: Kumar
Date: 8/4/2006 7:24:49 AM
Comment:
Ya it is working fine we sorted out problem with scrolling is fixed after postback.thanks
Title: .Net 2.0   
Name: Giovanni
Date: 8/2/2006 3:33:03 PM
Comment:
Does your control work in asp.net with 2.0?

ggomez@alum.syracuse.edu
Title: Please Interpret   
Name: John Cahill
Date: 8/1/2006 10:30:59 PM
Comment:
Hi, Justin,

The thing you built sounds just what I need but I don't know a lot about this, so, if you wouldn't mind:

What, exactly, does this mean, "Drop the compiled assembly into your bin folder and you are set to go." What is the "compiled assembly"? Is it a file? I could guess it is the 'StaticPostBackPosition.dll' file but ... that would be a guess. I don't know what a compiled assembly is so please explain? "Bin" folder? Firstly, what machine ... the web server? "Bin" folder ... I have searched my computer and there are 19 Bin folders. Which one should I put the "compiled assembly" in?

Thanks, in anticipation, for your clarification.

John
Title: Good Job   
Name: Dan
Date: 7/24/2006 5:29:51 PM
Comment:
Works great! Thanks!
Title: Tweak   
Name: Adam
Date: 7/12/2006 3:46:32 PM
Comment:
To get this to work in IE 6, I had to change document.body to document.documentElement
Title: Javascript error   
Name: Bala
Date: 7/11/2006 9:11:17 PM
Comment:
It works fine...
But..
When I use javascript calendar control, after postback i get javascript error and calendar control is not getting loaded
Title: Thanks   
Name: Manny
Date: 7/11/2006 1:11:52 PM
Comment:
Thanks so much! Its working great.
Any suggestions for retaining the scroll position in a div tag.

Manny
Title: great   
Name: adam
Date: 7/6/2006 5:57:04 AM
Comment:
worked first time, job well done
Title: Thanks   
Name: Gary
Date: 6/30/2006 2:37:42 PM
Comment:
Justin,

THANKS! This made my job so easy.
Title: astonishingly simple   
Name: Arun N Mahendrakar
Date: 6/29/2006 12:30:09 PM
Comment:
dudeee.. this was too easy dudeee

Thanks dudeee
Title: Sytem Analysist   
Name: Fed Derring
Date: 6/27/2006 10:40:26 AM
Comment:
Hi
I too am getting the errror

"document.forms.0.StaticPostBackScrollVerticalPosition is null or not an object" even though i have it in a server form.
I tried this(as suggested by Tim Mackey

document.serverForm and made sure that all my server forms had ID=serverForm.
It still fails. Is there any other hints you can provide to solve this?
Thanks - fed email:frank.deering@qwest.com
Title: adding this control   
Name: HELP
Date: 6/16/2006 12:31:25 AM
Comment:
Can you please clarify exactly how to add this control to my project?
Title: Thanks..You are Genius   
Name: Mithilesh Deshpande
Date: 6/15/2006 5:59:53 PM
Comment:
Hi Justin,

Thanks a lot...your code is Just-In..as your name.

This really helped in our project, we use a Calendar control, which uses IFRAME and with SmartNavigation, it was not getting rendered on Postback.

Bye bye to SmartNavigation and Welcome to StaticPostBackPosition

:)

Mithilesh
Title: Scroll position   
Name: Debojyoti Bose
Date: 5/24/2006 1:28:25 AM
Comment:
Good article.We faced the problem of scroll positioning in JSP.We added the code snippet and that works.
Title: Muy Bueno   
Name: Val
Date: 5/14/2006 7:38:19 PM
Comment:
Este pequeño .dll es fantástico, es lo que andaba buscando, graciass.
Title: Scrolls Works with Div and page scroll   
Name: xtremexploit@hotmail.com
Date: 4/6/2006 10:23:44 AM
Comment:
I have a control like this, BUT my control works with Div and preserve the page scroll...

send me a email xtremexploit@hotmail.com and i will send my controls for free.. (VB.NET)
Title: I have a control   
Name: I have a control
Date: 3/11/2006 12:27:06 PM
Comment:
I have a control like this, buy my controls works with Div and preserve the page scroll...

send me a email xtremexploit@hotmail.com
Title: Thanks   
Name: Chris
Date: 3/9/2006 2:13:13 AM
Comment:
It works. Great!
Title: This could save the world   
Name: Osama
Date: 3/8/2006 8:06:53 PM
Comment:
This is great. I ported it over to VB and I was in business. Very simple and works well.
Title: Works PERFECTLY!   
Name: Jeremy Reid
Date: 3/6/2006 3:42:22 PM
Comment:
Thanks so much man, it works perfectly. This was exactly what I was looking for. You just saved me so much time!

Thaks again.
Title: Thanx a lot   
Name: Ravi Khatri
Date: 2/22/2006 12:47:51 AM
Comment:
Thanx a lot JUSTIN. Simply great job
Title: What about Div element (or panel for that matter)   
Name: Felipe B.
Date: 2/16/2006 6:53:41 AM
Comment:
Is It possible to do the same with Div elements or Panels?
I usually use Div with autoscroll and inside it some datagrid with a select button, so when It's clicked It does a PostBack loosing the original position in the Div or panel.
Thanks
Title: You are the Man!   
Name: Lee
Date: 2/8/2006 5:55:05 PM
Comment:
Your control is bad to the bone. Just what I've been trying to accomplish. It works so well I honestly didn't think the page was even posting back. Thanks for your time and effort and making this great control available to the development community.
Title: I'm Impressed   
Name: Pablo Ganga
Date: 2/7/2006 7:33:15 AM
Comment:
I'm impressed this control is awesome
Title: Wow   
Name: Joel
Date: 1/26/2006 9:11:16 PM
Comment:
That is amazing. Installing it was way easier than I tried to make it. a person just needs to literally drop the dll file into the bin directory and then add the control to the page. WOW!!!!!
Title: Machi Super Machi - Thanks Machi.   
Name: Govind
Date: 1/6/2006 8:00:07 AM
Comment:
Its really wonderful, Now you have made an improvement over smartnavigation that having some flaw like CSS has been disappeared. now this looks simple and GREAT!!
Title: Thanks from Justin to Justin   
Name: Justin
Date: 11/28/2005 6:19:17 PM
Comment:
Thanks a lot for your control,

Its very easy to use.

Justin
Title: Thank!   
Name: bull_evil
Date: 11/10/2005 11:54:48 AM
Comment:
excelent in all the web said use the dam smart...Navi..shit..really thank a lot work very fine.
All you have to do it download the source.zip inside you will find StaticPostBackPosition.dll extract to somewhere then in vb.net...in the tool box panel...secundary mouse click then add..remove items then you have to search the somewhere path (extract path or look for dll) accept...you will see a new tool icon "StaticPostBackPosition", thats it you only have to drag and drop the new tool..vb.net do the work.
Title: Thanks!   
Name: Marc
Date: 11/2/2005 7:32:01 AM
Comment:
My javascript menu's would not work on postback with smartnavigation.

This totally solved the problem for me - Thanks!
Title: MaintainScrollPositionOnPostback   
Name: SC
Date: 10/26/2005 4:17:22 PM
Comment:
ASP.NET 2.0 has a property called MaintainScrollPositionOnPostBack. Works nice.
Title: available for jsp?   
Name: smurfy
Date: 10/18/2005 3:50:17 AM
Comment:
does anyone know if this cool thing is also available for jsp?
Title: DBA/Developer   
Name: Yen Yeoh
Date: 10/16/2005 9:11:18 PM
Comment:
Many Thanks Justin. It's working well!
Yen.
Title: Thanks   
Name: IndianaJonas
Date: 10/14/2005 1:52:07 AM
Comment:
Thanks Thanks Thanks
Title: Is It Suppose To Work Like This ?   
Name: Raf
Date: 9/30/2005 3:14:10 PM
Comment:
hey, the thing is awesom, really saves trouble, but when i used it in my asp pages, on eveypostback it jerks to the top and then comes to the scroll position. Is it suppose to be like that or is it because of any other reason?
Title: Thanks a Lot   
Name: Bhargav Joshi
Date: 9/29/2005 12:26:36 PM
Comment:
Thank you solved an irritating problem for me!
Title: Very nice   
Name: Reynold Tucan
Date: 9/22/2005 6:38:10 PM
Comment:
Very nice and easy to use solution. Solved the problem that SmartNavigation caused (disappearing javascript menu on postback). Awesome and thanks.
Title: Brill, neat and simple   
Name: Zoli
Date: 8/7/2005 10:10:10 AM
Comment:
Thanks Justin, I've had so many problems with that dreadful SmartNavigation and now thanks to you, there is no need to use it anymore.
Your solution works like dream.
Thanks again.
Title: Keeping Scroll Position over post Backs   
Name: xyv
Date: 8/4/2005 2:33:17 AM
Comment:
The Control is not working with Mozilla.
Title: smart navigation   
Name: pips
Date: 7/27/2005 7:28:17 AM
Comment:
Thank you so much. Smart nav worked on our dev machine but caused all sorts of technical problems when deploying to live! I needed a quick fix and you saved me having to write the control myself! You're a star and very generous sharing your work!!

Thanks!!
Title: not working in firefox   
Name: santhosh thomas
Date: 7/25/2005 11:12:53 AM
Comment:
hi, thanks for the code, its working in IE. But its failing in firefox (1.0.4)
Title: Greate Control   
Name: GWH
Date: 7/20/2005 5:15:32 PM
Comment:
Great control Jorge Arturo Aviles Nuñez; It works great.
Thanks
Title: GREAT   
Name: Eric Kwerreveld
Date: 7/1/2005 10:03:09 AM
Comment:
Great control!!! Thanks a lot, just what i needed.
Title: Brilliant   
Name: Graeme
Date: 6/21/2005 5:23:14 PM
Comment:
That is the quickest easiest thing I have ever had to do. It works a treat and I have placed it into all my applications.

Thanks you for the control!!! You are brilliant!!!
Title: Thanks!   
Name: Abdulla
Date: 6/4/2005 1:52:54 PM
Comment:
Thank you a lot for your control....
Title: You are fantatic   
Name: Kent
Date: 4/22/2005 12:29:16 AM
Comment:
The control is great... Thank to post this control
Title: Awesome!   
Name: Awesome!
Date: 4/6/2005 10:09:13 AM
Comment:
Awesome!
Title: Thanks   
Name: D
Date: 3/16/2005 6:29:50 PM
Comment:
Thanks a lot, it save me headache and time. Also a great sample for a newbe.
Title: Good one   
Name: Rajesh
Date: 3/5/2005 6:40:20 AM
Comment:
This is a good control and very easy to install. Thank you very much
Title: Please Help!!!   
Name: Victoria
Date: 3/3/2005 3:31:49 PM
Comment:
I'm getting the following error:

"JIT Debugging component registration is incorrect."

Do you think you can help???
Title: Getting that is null or not an object error   
Name: ewd
Date: 3/1/2005 3:05:36 PM
Comment:
Hi,

I'm getting this error when the project is copied to the test server:
"document.forms.0.StaticPostBackScrollVerticalPosition is null or not an object"

On my laptop is works as advertised. However in Visual Studio I get an error in the Design portion of the IDE for the form. In the upper left part of the screen it says "Error Creating Control - Staticpostbackposition1" and the info button says "Parse error: Unknown server tag jlc:Staticpostbackposition" I think it's having problems with the <@ Register... however I copied exactly what's on the page here. Anyone else seen this and no what bone head manuever I'm performing to get this? Other than that this is a great replacement for SmartNavigation!

Thanx,

Eric
Title: Oux   
Name: Smbie
Date: 2/17/2005 9:08:43 PM
Comment:
Stream, the control works great!

Thanks!!
Title: what about IE?   
Name: David Lee
Date: 2/16/2005 7:14:46 PM
Comment:
did i miss something? or.. does this assume SmartNav is still on for IE?

I have a server form, tag is inside form.. and it doesn't work in IE. (haven't tried FireFox yet)
Title: Stream   
Name: Jorge Arturo Aviles Nuñez
Date: 2/16/2005 3:47:50 AM
Comment:
Example of my Control:
Protected WithEvents CtrlPreserveScrolls1 As CtrlPreserveScrolls


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
CtrlPreserveScrolls1.Add( CtrlPreserveScrolls.TypeControl.DIV, "DivUsuarios")
CtrlPreserveScrolls1.Add( CtrlPreserveScrolls.TypeControl.DIV, "DivMaestros")
CtrlPreserveScrolls1.Add( CtrlPreserveScrolls.TypeControl.DIV, "DivAgentes")
CtrlPreserveScrolls1.Add( CtrlPreserveScrolls.TypeControl.THEWINDOW)
End If
End Sub
Title: Stream   
Name: Jorge Arturo Aviles Nuñez
Date: 2/16/2005 3:33:09 AM
Comment:
Hello, I have modified the code source, and I have created "webControl" able to keep the position from any DIV and scroll of the page.

Hola, he modificado el codigo fuente, Y he creado un "webControl" capaz de guardar la posicion de cualquier DIV y el scroll de la pagina.

You can see it from here:
http://www.clikear.com/portalweb/Grids.aspx

And can be downloaded here:
http://www.clikear.com/portalweb/ScrollForDivs_AND_ThePage.zip

Thanks rookK by the link, gracias viejo :D

Saludos
Title: So close...   
Name: Kevin
Date: 2/11/2005 9:57:40 AM
Comment:
This is exactly what I have been searching for. I'd be thrilled if I could just get it to work.

Any idea why this would work in mozila but not IE? IE isn't throwing an error but it's not working either.
Title: Why scrolls always jumps to 400?   
Name: Uros
Date: 2/7/2005 8:36:02 AM
Comment:
Hy!

I have the same questions like Terry... I copy/pasted the code to the page, but now scrolls always jumps to 400, so I don't get this function:

function RestoreScrollPosition()
{
scrollTo(0, 400);
}

It should jump to previous state (before postback)?
Title: Thanks   
Name: L.D.
Date: 1/11/2005 2:39:25 PM
Comment:
Wonderful! All formatting and scroll positions are preserved (they were was lost with SmartNavigation). Thanks a lot!
Title: asp.NET developper (MCAD)   
Name: Simon Jarry
Date: 12/23/2004 12:30:12 AM
Comment:
Thanks a lot ! I really appreciate this control I have been installing on every of my projects now ! this is the final solution.. forget SmartNavigation !!!
Title: tip for null error   
Name: Tim Mackey
Date: 11/23/2004 6:02:24 AM
Comment:
hi,
i also got the error:
"document.forms.0.StaticPostBackScrollVerticalPosition is null or not an object" even though i had it in a server form. the problem was that i had some html forms before the server form, and obviously then the hard coded document.forms[0] was referring to the wrong one. i changed this code reference to: document.serverForm and made sure that all my server forms had ID=serverForm.
this is a great control. thanks for making it freely available.
Title: Sapient Corporation   
Name: Jassi
Date: 11/22/2004 12:39:04 PM
Comment:
Thanks.... this is a real cool stuff...
Title: Fantastico   
Name: Gift
Date: 11/2/2004 5:35:25 AM
Comment:
Thatz gr8, thankx a lot
Title: Developer   
Name: Moojjoo
Date: 10/27/2004 2:55:22 PM
Comment:
How do I get this control to show up in my toolbox?
Title: Happy Bunny   
Name: Norry Passway
Date: 10/27/2004 6:20:02 AM
Comment:
Great! Amazing to think that it wasn't a feature of ASP.NET. Works a treat and I am a happy bunny. Thanks for posting this solution.
Title: Finally, a scroll-position script that works!   
Name: Todd Taylor
Date: 10/26/2004 2:11:39 PM
Comment:
Thanks for posting this solution, Justin. I tried multiple other solutions to the scroll-position problem, but all the other solutions seemed to either create new problems or they just didn't work with my web pages dynamic panels. You solution seems to work perfectly :)
Title: Cool Control   
Name: Saharul Nizam Saaidi
Date: 10/20/2004 9:01:00 PM
Comment:
I would like to thank you for creating this control. I think it is a cool control. It is simple control, but to me it is very useful.

Thanks a lot.
Title: Damn good   
Name: chaminda jayakody
Date: 10/13/2004 2:26:49 PM
Comment:
i love u man,
Title: Mr   
Name: Doug Stowell
Date: 10/5/2004 9:34:21 AM
Comment:
Really helpful - got me out of a potential showstopper!!! Thanks.
Title: thanks a lot   
Name: Frances
Date: 9/30/2004 6:57:33 AM
Comment:
You made me a very happy person!
Title: Thanks!!   
Name: Yeiouaryii
Date: 9/29/2004 3:36:32 AM
Comment:
Perfect!
Thank you very much.
Title: RestoreScrollPosition?????   
Name: Terri
Date: 9/23/2004 8:27:05 PM
Comment:
Maybe I'm missing something but when I put this in my code it always scrolls to 400 (or whatever the last number is). I see the comment says determined during runtime but don't see how since the numbers are hard coded.

function RestoreScrollPosition() { scrollTo(0, 400); // determined during run-time}
Title: Re: Client Script Errors   
Name: Justin Lovell
Date: 9/22/2004 1:06:26 PM
Comment:
Hi guys,

I bet you that most of the problems is caused under the following scenerios:

* You don't have a server-side form.
* The control was not dropped in a server side form.

To resolve the problem, do the converse (opposite) of the things that you are doing wrong where it applies.

Cheers,
Justin
Title: StaticPostBackScrollVerticalPosition   
Name: Stuart
Date: 9/22/2004 12:23:17 PM
Comment:
Justin,

I am also getting a client side script error with the message that "document.forms.0.StaticPostBackScro
llVerticalPosition is null or not an object"

Regards,
Stuart
Title: "RE:Looks like Stanley Glass's code?" and "RE: Works like a charm for me so far"   
Name: Justin Lovell
Date: 9/19/2004 3:40:08 AM
Comment:
Luu and Stan,

I have blogged a response to both of your comments over here: http://blogs.aspadvice.com/jlovell/archive/2004/09/18/1683.aspx
Title: Works like a charm for me so far   
Name: Luu
Date: 9/17/2004 8:18:36 PM
Comment:
This will save a lot of people frustration using smart navigation. This is what you would expect from the development community and shows we are all out to solve the same problems. I hope Microsoft solves this problem with ASP.NET 2.0?

Thanks, Justin
Title: Thanks   
Name: Joe
Date: 9/14/2004 6:35:09 PM
Comment:
Thank you very much for this control, there's only one bug when I use a DataGrid + nested ASP Repeater, the problem is because I use a CheckBox to display the Nested ASP Repeater so with your control it doesn't scrolls down well because it only counts the pixels (rows) the first time the page is loaded so when it is refreshed it doesn't returns to your exact position.
Title: StaticPostBackScrollVerticalPosition   
Name: Rahul
Date: 9/14/2004 3:33:49 AM
Comment:
hey Justin,

we are getting a client side script error with the message that "document.forms.0.StaticPostBackScrollVerticalPosition is null or not an object"

Any help would be much appreciated.

Regards,
Rahul
Title: Re: Only works on refresh not postback   
Name: Justin Lovell
Date: 9/11/2004 1:10:18 PM
Comment:
Don,

You are required to have a server side form for the JavaScripts to register. Please check this.

Thanks,
Justin
Title: Only works on refresh not postback   
Name: Don
Date: 9/11/2004 8:27:35 AM
Comment:
After being frustrated with SmartNavigation I tried this control and found that it only works on a forced refresh not on a postback. This is similar yet a different condition than Lou posted. Is there any code I need to write in the Page_Load?
Title: Woo Hoo   
Name: Ahmed
Date: 9/6/2004 4:59:42 AM
Comment:
Justin Lovell is the coolest guy ever. I appreciate you sharing the knowledge. Take it easy...
Title: Many Thanks   
Name: Bill Potter
Date: 9/1/2004 8:49:18 AM
Comment:
Many thanks this was exactly what I was looking for.
It has solved various problems I have had with various sites
Bill
Title: Excellent solution   
Name: DanielG
Date: 8/23/2004 6:44:58 PM
Comment:
This is just wath I need. Works great!!!
Title: Work great with my templated site   
Name: Scott
Date: 8/20/2004 7:25:36 PM
Comment:
Could you add IE to the script? or is it just best to use smartnavigation?

Cheers, saved me a huge headache. :-)
Title: Groooooovy!   
Name: Tammy
Date: 8/19/2004 10:30:14 AM
Comment:
A perfect solution! It rocks! No more smartnavigation!
Title: Thanks   
Name: Eric
Date: 8/3/2004 12:46:09 AM
Comment:
Thanks...it works great...beside improve the CSS problem, it also allow the ASP.NET popup a new child window with focus..
Title: Works great -but   
Name: Lou
Date: 7/26/2004 11:22:10 PM
Comment:
This does a great job of maintaining scroll position during postbacks but it causes my javascript menu bar to disappear from the screen until I do a clean reload of the page. Therefore I sadly cannot use it in my application. Anyone know a possible workaround?

Lou
Title: ??!!   
Name: Elaine
Date: 7/13/2004 11:50:37 AM
Comment:
I am getting the following error when I try to use this control:

"document.forms.0.StaticPostBackScrollVerticalPosition is null or not an object"

Any help would be much appreciated.

Elaine
Title: Very Good.   
Name: Gopi
Date: 7/5/2004 7:22:52 AM
Comment:
Thanks!!. The Controls works fine. It is appeciated if the control also get the focus() of the last postbacked control.
Title: President Hallandales Inc.   
Name: Gary Eisert
Date: 7/1/2004 6:05:57 PM
Comment:
Thanks a million for your time and the expense of putting these solutions on the Internet for developers to solve these kinds of problems.

Works just fine!! 86 SmartNavigation....
Title: Thanks!   
Name: Christy
Date: 6/26/2004 1:42:40 PM
Comment:
Thanks so much! I was having a problem with the SmartNavigation in that I had a Calendar control that is called from a pulldown menu. The SmartNavigation always gave the main page the focus, which would hide the calendar page. Your application solved this - thanks!

Christy

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 7/31/2014 11:42:47 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search