in

ASP.NET Weblogs

Andrew Frederick

Maintain Scroll Position after Asynchronous Postback

Do you want to maintain the scroll position of a GridView, Div, Panel, or whatever that is inside of an UpdatePanel after an asynchronous postback?  Normally, if the updatepanel posts back, the item will scroll back to the top because it has been reloaded.  What you need to do is “remember” where the item was scrolled to and jump back to there after the postback.  Place the following script after the ScriptManager on your page.  And since the _endRequest event of the PageRequestManager happens before the page is rendered, you’ll never even see your item move!

<script type="text/javascript">
    var xPos, yPos;
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_beginRequest(BeginRequestHandler);
    prm.add_endRequest(EndRequestHandler);
    function BeginRequestHandler(sender, args) {
        xPos = $get('scrollDiv').scrollLeft;
        yPos = $get('scrollDiv').scrollTop;
    }
    function EndRequestHandler(sender, args) {
        $get('scrollDiv').scrollLeft = xPos;
        $get('scrollDiv').scrollTop = yPos;
    }
</script>

Comments

 

Marcel Boersma said:

This small script possibly saved my life. Very easy implementation in this way.

Thanks a lot. :)

March 6, 2008 4:03 AM
 

Wilson West said:

Pure sweetness - after looking all over for something like this, this is a easiest and most elegant solution yet.

March 24, 2008 4:14 PM
 

John Hunter said:

Looks like just the thing I was after - except...

The scrollDiv in my case is a panel which is the PopupControlId of a PopupcontrolExtender.  The panel itself has an updatepanel (to handle the selection/deselection of a checklistbox) inside it (as well as outside).  Am I just missing something on the $get (i.e. to find my panel inside of a nested updatepanel)? - Any help appreciated - as I'm almost there on a dropdown multi-select combo like control.

Thanks

March 26, 2008 5:33 AM
 

Simeon said:

Great help!

Thank you very much!

June 12, 2008 8:11 AM
 

simon said:

It has really helped me.Thanks a lot!

June 12, 2008 9:16 AM
 

Nate said:

Excuse my ignorance, but can I put that code in a jscript file, and how exactly would I reference it in a div tag?

Thanks.

July 29, 2008 3:00 PM
 

Nash said:

If we added the div tag, and the size of the control is dynamic based on the conditions, it will not be good in the UI.

August 8, 2008 11:06 AM
 

Kannan said:

You are a ROCK........

Thankyou verymuch

September 27, 2008 5:23 AM
 

Brian said:

If you are having a problem with sys undefined... make sure you put this bit of script in your code after your gridview control. This will allow enough time for the scriptmanager to load from your master page if you are using one.

October 16, 2008 12:22 PM
 

Jim said:

I would like to say this post saved me hours. Cheers mate.

December 2, 2008 10:43 AM
 

dotnetguts said:

I have tried this trick but it doesn't work for me

I am applying to div tag for rating control? Is it has something to do with control.... Somehow i can't able to  get through your tip.  I am using Master Page/ Content Page scenario.

dotnetguts.blogspot.com/.../rating-control-ajax-display-message-on.html

December 6, 2008 5:38 PM
 

vvdhar said:

Any know how to get this to work when the script manager is in the master page and the panel (the position of which I need to maintain) is in the content page? I tried putting the above JS code at the bottom f the page I get a JS error saying 'Object required'. I think this is the line that does it

Sys.WebForms.PageRequestManager.getInstance();

and I think it is because my script manager is in the master page.

BTW, this works fine if I use it on another aspx page which has no master page.

December 9, 2008 4:36 PM
 

rvarcher said:

If you're trying to reference a Panel or a div that's runat server then the JS script needs the control's unique id, so I thought you could just do something like: $get('GridviewTestForArtie.ClientID') BUT this never retrieved the ClientID in my testing. One alternative is to just use an HTML DIV tag that's not run at the server so the ID you give it isn't changed, another alternative is to get the ClientID - the .Net generated ID (do a View Source or something) and put that in the JavaScript.

Also, this block of JS code needs to be after the DIV, Panel, whatever it is you're referencing.  If your ScriptManager is in your master page, and you put the code there but before your ContentPlaceHolder then it's not going to work. I believe it would be best to put it in the content page after the DIV or Panel. I did that and it worked for me.

December 23, 2008 5:54 PM
 

Sivaraj said:

You saved my life too...

February 5, 2009 6:59 AM
 

shiggity said:

This is about as helpful as helpful can get... awesome

March 13, 2009 8:12 PM
 

Ron said:

Is there any way you can convert this to work witha master page. All of the java script has to be run from the master page and this seems to break the code.

Thanks.

March 21, 2009 11:03 AM
 

Curt said:

Thanks a million!!!  Saved me hours.  You rule.

March 21, 2009 5:46 PM
 

Joe said:

Help!  I have used the script as given on a textarea within an Updatepanel. The textarea dimensions are set. The scrolltab does hold postion but I am getting some serious textarea flicker upon asynchronous postback. Is there a way to supress the flicker?

March 23, 2009 2:39 PM
 

Neha said:

Thank y ou Soooooooooooooo Much it is a great solution

April 21, 2009 5:16 AM
 

Sheebs said:

Sweet. Nice one mate! Works a charm

April 24, 2009 6:56 AM
 

Joe said:

I have multiple areas with scrollbars in separate updatepanels on the same page. I placed the script immediately after one scrollable area  and the scroll bar stays as advertised. great work. However, please tell me how to handle several on one page. This approach is not working with multiple scrollables. The later one gets the scrollbar functionality I want. Why I can't I place it just after the script manager and have it work? Thanks.

April 30, 2009 7:01 PM
 

Ratheesh said:

Thanks a lot ....!!!

May 1, 2009 4:00 AM
 

CD said:

Thanks. This helped a ton and saved a lot of time.. kuddos to you.

May 18, 2009 11:52 AM
 

dabram said:

Simply Awesome! worked great. Thank you, Thank you, Thank you!

May 28, 2009 12:02 PM
 

Ben said:

Thanks, this really helped!

June 3, 2009 10:26 AM
 

Mike said:

DUDE, I FREAKING LOVE YOU FOR THIS, I FEEL LIKE CRYING...I'VE SPENT FOREVER LOOKING FOR SUCH BEAUTIFUL CODE...FREAKING AWESOME

June 18, 2009 4:22 PM
 

AnHund said:

Great stuff. Thanks a lot :-)

July 5, 2009 8:14 AM
 

Bob said:

Hi - thanks so much you are a genius!  This is by far the simplest approach I've found on the web and the only one that worked in my situation!  Awesome!

July 14, 2009 11:55 AM
 

Jose Antonio said:

I love you. I've tried to do the same for three days and I wasn't able to do anything.

You're  brilliant

August 19, 2009 8:59 AM
 

Ravi said:

i used the update panel , and inside the update panel i have a scrolling div with gridview. but above code is not working in my application, so help me.

August 26, 2009 9:59 AM
 

Michael said:

Kudos to you sir.  Thanks for the great insight.  This also helped me out greatly!!

:)

September 17, 2009 10:34 AM
 

InVirginia said:

Lifesaver! Thanks!

October 13, 2009 12:19 PM
 

harshaghanta said:

Great post ..

Really helpfull

Thanks

October 19, 2009 11:29 AM
 

757 said:

YOU ARE TOO KIND WITH THIS!

HUGE THANKS!

October 26, 2009 9:41 AM
 

Abhishek Tayade said:

Thanx a lot yar,

Realy very  Great/Genius work yar.

Thanx a lot

Abhishek

November 9, 2009 9:37 AM
 

farhit said:

This is great, thanks

November 13, 2009 6:31 AM
 

Jami said:

PERFECT!  Easiest soluton BY FAR after Googling for over an hour!

December 4, 2009 2:21 PM
 

WereWolf said:

Hi, I make it work with masterpage, you simply need to put the script at the end of the page, just before the </asp:Content> tag, and replace the scrollDiv  name by something like this :

xPos = $get('<%=Panel1.ClientID %>').scrollLeft;

Pretty good script!

December 16, 2009 11:00 AM
 

Oo19 said:

Hi,

I have a little problem with this solution (and with every other solution I've tried for maintaining the scroll position):

The div returns to its previous position and it works perfectly when it's only scrolled vertically or only scrolled horizontally.

But, if the div is scrolled vertically AND horizontally, after the partial postback the page flickers.

For some small amount of time I can see the top of the div before it scrolls down into position. If I switch the order of the lines that set scrollTop and scrollLeft, so that scrollTop is set first, then I can see, for some small amount of time, the leftmost side of the div, before it scrolls right to its previous position.

This happens on Firefox 3.5 and IE7.

I was wondering if there's a way of avoiding this flickering, perhaps some way to tell the browser to set both scroll values at the same time?

Thanks!

December 28, 2009 9:36 AM
 

KyDerbyMan said:

Anyone tried using this jscript for a gridview in a panel that's part of a user control loaded dynamically into a tab container at run-time?

I can't get the javascript to run at all.

argh

January 6, 2010 4:28 PM
 

Shiv Pratap Singh said:

Hey,

I am spellbound by this script, realy great script to handle scroll position.

Shiv

January 7, 2010 7:55 AM
 

KyDerbyMan said:

I'm actually doing a hybrid version of the code from here with this code:

www.vbforums.com/showthread.php

Loading a user control is a whole different animal, apparently.

January 7, 2010 1:02 PM
 

Kevin Hicks said:

Best idea I have run across yet.  I got it working in less then 5 minutes.  My scenario was this

Master page, content sections

user control in body content section wrap inside update panel

User control page had a panel with a listview which scrolls vertically.  Just had to add the javascript to the button of my user control and change the scrollDiv parts to <%= panel.clientID%>

Thanks a million!

January 12, 2010 11:10 AM
 

watercloud said:

Can any one show a ful working example with master page, content, and gridview?

February 18, 2010 4:45 PM
 

Dennis said:

WOW. After a year on and off messing with different solutions, half could never get to work, half not working as I hoped I can't believe I found this one. Simple + Works = PERFECT

watercloud: Make sure you put this routine the LAST thing before the </asp:Content> tag on the content page and change 'scrollDiv' to actual asp control name (mine was 'divFilterList' and should work. I was putting after ScriptManager on Master Page with no luck.  

February 19, 2010 3:20 PM
 

Babak said:

WOW . A lot of thanks for your great help.

February 23, 2010 4:41 AM
 

Captain said:

After Googling for 2 days, I run into the this. Easiest solution by far. i got it working in a minute

March 16, 2010 2:06 PM
 

marko said:

Billiant. A life saver. Thank you.

April 2, 2010 3:02 AM
 

Scott said:

This solution rocks! Really, after scouring EE I found a link to this page. Wonderful solution as I have grids nested in tables. This is SWEEEEET!

tyvm!

April 21, 2010 10:28 AM
 

JERIN ANTONY said:

THANKS A LOT BRO.... SAVED LOT OF TIME

May 6, 2010 6:08 AM
 

Talha Ashfaque said:

Thanks man, i have been looking for this solution for a long time.. Thanks a bunch

May 20, 2010 11:46 AM
 

Sunmeet Singh said:

Thanks a lo man, it totally made my day,,, great code :D

May 25, 2010 9:05 AM
 

Vara Prasad said:

I placed the code the scrolling is working but i have a update panel in aspx page which it is inherited by master page and i placed the above code but the update panel is not working?

can i get the solution for the above problem

May 31, 2010 6:37 AM
 

tjaank said:

thanks man

June 16, 2010 1:09 PM
 

bashkutty said:

Dear All,

It is working fine for me when the ListBox SelectionMode ="Single", But it is not working SelectionMode ="Multiple"

August 2, 2010 7:41 AM
 

deepak.chennai said:

Hi Andrew,

thank u so much,

thank u very much.

August 3, 2010 2:46 AM
 

deepak.chennai said:

Hi Andrew,

thank u so much,

thank u very much.

August 3, 2010 2:46 AM
 

Michael said:

Not only did it not work, but it somehow managed to prevent my asynchronous postback from working- the entire page would postback and refresh.

August 13, 2010 9:28 AM
 

Glenn Chalmers said:

Hi when I set this code I am receiving a value of "0" for scrollTop whenever I try using this code

$get('scrollDiv').scrollTop;

which means it doesn't work.

I have a Masterpage and a content page and repeater with a user control in a panel. Any ideas?

September 14, 2010 9:14 AM
 

Nelu said:

guys, I have the following scenario.

I have multiple Panels in my page. just one is visible=true; all others are visible=false. When I clik on a particular button I create server-side with async postback one panel visible=true. In this panel I have a div with scroll, also the javascript provided in this post. In the div with scroll I have a repeater control. when I select something from repeater, an asyc postback it is happen but the scroll is not maintain the position. Also I can not find the div and script in the client side view source code. but in my code is iserted exactly after the div.

If I put everything in a visible panel first time it is working fine. How can I sove this problem for visible false panels?

September 16, 2010 11:45 AM
 

Avinash said:

Does it work with mozilla browser? i tried with mozilla and its not working.

October 11, 2010 6:20 AM
 

hamdy said:

i think this is the best code i see to solve this issue.

Great job.

October 12, 2010 3:45 PM
 

yuipcheng said:

super!

works on firefox 3 also.

October 22, 2010 6:20 PM
 

Andrey said:

Just Great! Thanks a lot!

October 26, 2010 4:52 PM
 

Nagarajan said:

Its great, Keep it up !!!

October 28, 2010 5:29 AM
 

Bharath said:

Excellent! Saved me lot of time! Thanks.

November 17, 2010 10:49 AM
 

Juber Khan said:

Three words for you...

Awesome Awesome Awesome...

December 14, 2010 3:10 AM
 

Ashish said:

Great Work Bro........... works with listbox selection mode single although I am not able to get it working for selectionmode= multiple .......... Thanks a lot

December 21, 2010 1:10 AM
 

Hans Schroeder said:

Great, that's what I was looking for half of the day.

December 26, 2010 1:15 PM
 

Aaron said:

I may be a bit late to the party, but thanks for the code. It was exactly what I was looking for.

January 20, 2011 1:50 PM
 

Abhijit said:

Great job, Thanks man!!!!

January 28, 2011 1:46 AM
 

manreet said:

didnt workd......................delete this code.................i wasted alot of time working on this..............

February 16, 2011 4:08 AM
 

mobz said:

for me this javascript code is not working

i dont knw the reason

February 24, 2011 10:34 AM
 

Yohanes said:

mantap, terima kasih banyak yah. aku pusing solusinya ternyata disini. thx a lot

February 25, 2011 3:21 AM
 

Vikas Tiwari said:

If you don't know how to use this code then don't comment to delete this code. Well great article that was. Helped me in saving a lot of time. Thanks again.

May 4, 2011 4:56 AM
 

sobinscott said:

Not working in chrome

May 18, 2011 2:08 AM
 

mscheaf said:

Fail. Doesn't work for Master page as many many many people have pointed out.

May 23, 2011 11:18 AM
 

sobinscott said:

Have you tried it in chrome?

Not working for me in chrome and safari.But for other browsers works fine.

Please provide a solution

May 31, 2011 3:18 AM
 

kazim said:

thanks a lot man

great work

June 1, 2011 8:40 AM
 

Mukesh Rawat said:

Thanks a lot man,nice stuff.

I was using Panel inside Master Page and ContentPlaceholder

Follow below steps

Remove scrolldiv by

ctl00_ContentPlaceHolder1_Panel2

put your panel name instead of Panel2(it is my panel name)

It's working for me.

June 10, 2011 5:39 AM
 

Madeeha said:

its not working for me..

heres my code if you can help

<asp:ToolkitScriptManager ID="ScriptManager" runat="server">

   </asp:ToolkitScriptManager>

<script type="text/javascript">

   var xPos, yPos;

   var prm = Sys.WebForms.PageRequestManager.getInstance();

   prm.add_beginRequest(BeginRequestHandler);

   prm.add_endRequest(EndRequestHandler);

   function BeginRequestHandler(sender, args) {

       xPos = $get('MsgDiv').scrollLeft;

       yPos = $get('MsgDiv').scrollTop;

   }

   function EndRequestHandler(sender, args) {

       $get('MsgDiv').scrollLeft = xPos;

       $get('MsgDiv').scrollTop = yPos;

   }

</script>

   <div style="left: 317px; top: 84px; position: absolute; height: 247px; width: 427px">

       <asp:UpdatePanel ID="UpChat" runat="server">

       <ContentTemplate>

           <dx:ASPxHiddenField ID="Hidden" runat="server"

               style="left: 0px; top: 247px; position: absolute; height: 33px; width: 212px">

           </dx:ASPxHiddenField>

           <asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="2000"

               ontick="Timer1_Tick">

           </asp:Timer>

           <div id="MsgDiv" runat="server"

               style="color: #FFFFFF; cursor: text;overflow:scroll; background-color:White;">

           </div>

       </ContentTemplate>

       </asp:UpdatePanel>

   </div>

June 27, 2011 7:07 AM
 

Mark said:

What a freaking life saver!  Thanks!

June 29, 2011 12:24 PM
 

Sylvia said:

Thanks - helped me heaps

This also worked with jScrollPane - adapting it slightly - for some reason for me the maintainPosition of jScrollPane was not working with UpdatePanel updates. So i added

the follow to my js

var scrollingDivToReScroll;

var xPositionScroll;

var yPositionScroll;

$(function () {

   initialiseScrollPane();

});

function pageLoad() {

   if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {

       Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequesetHandler);

       Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);

   }

}

function beginRequesetHandler(sender, args) {

   if (scrollingDivToReScroll != null) {

       var api = scrollingDivToReScroll.data('jsp');

       if (api != null) {

           xPositionScroll = api.getContentPositionX();

           yPositionScroll = api.getContentPositionY();

           // shall we change the cursor to a wait cusor

           $('body').css('cursor', 'wait');

       }

   }

}

function endRequestHandler(sender, args) {

   initialiseScrollPane();

   if (scrollingDivToReScroll != null && xPositionScroll != null && yPositionScroll != null) {

       var api = scrollingDivToReScroll.data('jsp');

       if (api != null) {

           if (xPositionScroll != null) {

               api.scrollToX(xPositionScroll);

           }

           if (yPositionScroll != null) {

               api.scrollToY(yPositionScroll);

           }

       }

   }

   $('body').css('cursor', 'auto');

}

function initialiseScrollPane() {

   scrollingDivToReScroll = $("#styledScroll").jScrollPane(

       {

           showArrows: true

       }

   );

  }

July 4, 2011 9:21 AM
 

Ankur said:

Awesome Work...Keep Posting and Helping others !!! :-)

July 18, 2011 4:01 AM
 

Steve said:

Great posting, simple & effective.

Thanks

August 2, 2011 5:33 AM
 

Rod said:

Save me tons of frustration! Thanks!

August 15, 2011 2:48 PM
 

Rupesh said:

Thanks a lot. This worked for us.

August 16, 2011 1:31 PM
 

Kiran Pothina said:

Thanks a lot :)

I tried so many ways but this is the best among all..

August 18, 2011 12:19 AM
 

chj01 said:

This is Great It works fine.

for my case I have a master page and in it  I have a div tag around the contentplaceholder

                     <div id="divContent" style="left: 8px; position: relative; width: 100%; height: 100%;">

                           <asp:ContentPlaceHolder ID="MainContent" runat="server">

                               <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />

                           </asp:ContentPlaceHolder>

                       </div>

So all I had to do is replace scrollDiv' for 'divContent' and it worked like a charm.....

THANKS!!!!!!!!

August 18, 2011 5:11 PM
 

sam said:

When I am using above code..

I am getting error of java script...object required..

September 5, 2011 3:41 PM
 

layer7 said:

Kudos to you. I've tried several other methods, none of which have worked. This one worked a treat.

September 16, 2011 9:03 AM
 

Chamin said:

Fantastic. Thanks a lot !

October 14, 2011 3:32 AM
 

meth said:

add MaintainScrollPositionOnPostback="true" attribute to the page's @ Page directive

October 20, 2011 2:18 AM
 

Rakesh Shemadkar said:

I dont have words ,but this was one of the important and the best ever solution i had for the scroll position of controls for any asp.net page..Thanks a LOT...................................................................................................................................

October 31, 2011 2:01 AM
 

udara said:

Can anyone give me a small way to accomplish this?

November 5, 2011 4:57 AM
 

Mobins said:

Thanks....Work perfectly.. too good...

November 7, 2011 1:12 AM
 

Graham said:

Epic Effort. Thanks for sharing.

November 9, 2011 10:03 PM
 

Ken said:

Sylvia, many thanks for the jScrollPane code - works great on my implementation also.

December 1, 2011 11:50 AM
 

brutus maximus said:

superb script Andrew! This was vexing me for hours and hours. Your script saved my day!

Brutus

December 18, 2011 8:35 PM
 

Dan said:

What can I say that hasn't been said ... you da man!

December 22, 2011 9:09 AM
 

ngonhua said:

THANK YOU SO MUCH!

January 5, 2012 1:59 PM
 

Ciaran said:

You absolute legend!

January 13, 2012 10:45 AM
 

Bat said:

Thanks A lot .

I hv been searching this for 2 days..

U saved my life.

January 19, 2012 2:34 AM
 

Akram Abu Haltam said:

Great,,, Problem solved...... Thanx

January 24, 2012 6:36 AM
 

lakhwinder said:

Thanks a lot.....I dont have words to explain

January 25, 2012 12:24 AM
 

DanO said:

Works great in most cases. One case where I still get a flicker: I have an elapsed time clock (Ajax asp.Updatepanel, asp:textbox and asp:timer) that updates once per second. If the user scrolls quickly (between ticks), no problem.  If the user scrolls slowly, the screen jumps.

Any ideas to work around that?  Is there a way to detect that the user is scrolling and disable the timer until they stop?

January 30, 2012 4:20 PM
 

Joel said:

Very cool.  Does what I wanted ; ))  I am doing some processing on SelectedIndexChanged to limit the user to only 10 selections.  My multi select listbox was scrolling back to the top on autopostback.

February 7, 2012 12:01 PM
 

Mudassar said:

Thanks a ton!!! it worked perfectly fine..

February 14, 2012 3:55 AM
 

Spark said:

This does not work for content page that uses master page. Can you please tell me how to maintain scroll position for page that uses master page?

February 23, 2012 6:24 AM
 

Joseph said:

Thanks dear. it's working fine..

February 27, 2012 2:10 AM
 

Charith said:

Thanks man....!!! working great.....

March 14, 2012 5:58 AM
 

Mithilesh said:

Hey Spark  I found the solution solution to maintain scroll position for page that uses master page .

Add following code in your script :

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_beginRequest(beginRequest);

function beginRequest()

{

   prm._scrollPosition = null;

}

I have also added MaintainScrollPositionOnPostback="true"  in page tag

March 22, 2012 12:41 AM
 

Jeff said:

You're my hero!  I've been trying to figure this out for waaaaaaay longer than I'd care to admit.

March 28, 2012 2:03 PM
 

Rakesh Sable said:

Too Coll, great job and thanks alot

April 13, 2012 5:52 AM
 

matt said:

it did not wrk for me , i am using json to make dynamic html in div

please help

April 24, 2012 2:49 PM
 

perumal said:

great help

Thankyou

April 30, 2012 3:52 AM
 

Hamid Hesar said:

Very simple and useful script

May 15, 2012 3:14 AM
 

Stranger said:

Guys guys guys,

Please provide "HEIGHT" to the Div for those cases if it is not working.

May 25, 2012 3:35 AM
 

Nilesh Nikumbh said:

Thanks for this very easy solution..

May 30, 2012 11:10 AM
 

codemonger13 said:

Dude, that script totally worked.  Thanks.

June 14, 2012 2:37 PM
 

Chinu said:

Fantastic....after long hours of browsing, I found this solution works fine

July 5, 2012 2:52 AM
 

yogibirajdar said:

Thanks ......

Really it saves my life

July 5, 2012 3:40 AM
 

Chinu said:

Fantastic....after long hours of browsing, I found this solution works fine

July 20, 2012 9:22 AM
 

devioidofsilence said:

Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks

:)

July 27, 2012 5:57 AM
 

Ullas Sadanandan said:

Thanks............you are great......... :)

August 1, 2012 4:22 AM
 

Rich said:

I'm going to have to steal Wilson West's line.  PURE SWEETNESS!

August 3, 2012 5:19 PM
 

Manish said:

Dude ur jus awsome.

God bless u.

August 30, 2012 11:56 PM
 

Henry said:

Excellent, best regards!

September 14, 2012 10:29 PM
 

Santhosh said:

Sys.WebForms.PageRequestManager.getInstance()

i get the error on Sys is not defined ..

how to solve pls help me

September 18, 2012 8:40 AM
 

Koti said:

Excelent , easy implemnetaion, thanks for your work

November 7, 2012 12:43 AM
 

Wernerh said:

FANTASTIC!

After searching for hours and trying several (some rather complex) javascripts, I finally found this: elegant, small, and above all: WORKS INSTANTLY!

Great work, thanks a million!

November 7, 2012 7:26 AM
 

Tiaan said:

GREAT POST!! that piece of code was a life saver.

Modified it a bit and all 3 of my grids are maintaining thier scroll position

December 5, 2012 11:27 PM
 

Deepu said:

Thanks Very good post it solves my problem thanks alottttttt

December 7, 2012 6:28 AM
 

Deepu said:

No its not working for pages that have master page could any one pls help me out

i have master page and i use that on my entry page on my entry page i have 4 cascaded dropdowns but i am unable to maintain scroll position when i select one

December 7, 2012 7:16 AM
 

Aldo said:

that's a really nice piece  of code! :) Keep posting

December 28, 2012 5:59 PM
 

Arun said:

Worked for me with Master Pages. Reference the ID of the panel this way

yPos = $get('Content_RolesAdmin').scrollTop;

Where Content is the ID of the contentplaceholder in the master file and RoleAdmin is the ID of the panel.

Thanks

January 8, 2013 1:15 PM
 

Martin said:

Great one. Many Thanks

January 11, 2013 10:09 AM
 

JB said:

I have tried this script on my page and it doesn't work. Here are the particulars of my situation:

1) Page is ascx contained inside an iFrame.

2) There are 4 UpdatePanels, each one needs to be controlled by this no-scroll script.

3) All 4 UpdatePanels are contained inside of one Div with an ID of "scrollDiv".

4) The script seems to have zero affect on the page. It scrolls just as before.

Can anyone help?

February 5, 2013 11:13 AM
 

Sujit said:

Great. It worked like a charm.

March 14, 2013 10:33 AM
 

imon_1 said:

Thanx for such a help. . . .its a Great work

March 21, 2013 3:25 AM
 

Git said:

It is not working for me.

I have master page.

Included the above JS in contact page just before </content>

I need to maintain scroll position each time when poast back happens. But it is not working. Any ideas

April 10, 2013 12:48 PM
 

M S Dhoni said:

Hey dude.! Thanks so much for you post.!It worked really fine for me. i have not felt that great even when i won the world cup

April 26, 2013 5:54 AM