This is a migrated thread and some comments may be shown as answers.

Save Scroll Position

4 Answers 65 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 26 Aug 2010, 10:19 PM
Hello,

I have a tabstrip with the multipage's scrollbar property set to 'auto'. When the content inside the pageview grows too large, the scrollbar appears and works excellently.

However, anytime there is an ajax postback on the page, the pageview's scrollbar gets reset to the top. I was just wondering if there is a relatively simple way to force the pageview to remember its scroll position after a postback.

Using Q2 2010 and IE7

Thank you,
Josh

4 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 31 Aug 2010, 02:04 PM
Hi Josh,

You can use OnRequestStart and OnResponseEnd client-side events of the ajax manager to save the scroll position and then use it to scroll the pageview. Let me know weather this approach is suitable for you.

Best regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Josh
Top achievements
Rank 1
answered on 31 Aug 2010, 06:09 PM
Hello Yana,

Thanks for the information. I have implemented this:

var scrollPosition;
 
function beginRequest(sender, args) {
        var multiPage = $find("<%= multiPage.ClientID %>");
        var currentPage = multiPage.get_selectedPageView();
        var element = currentPage.get_element();
        scrollPosition = element.scrollTop;
    }
 
    function endResponse(sender, args) {
        var multiPage = $find("<%= multiPage.ClientID %>");
        var currentPage = multiPage.get_selectedPageView();
        var element = currentPage.get_element();
        element.scrollTop = scrollPosition;
    }

It is working. Code posted for anyone with the same problem.

Josh
0
Ray Merckel
Top achievements
Rank 2
answered on 06 Apr 2011, 07:56 PM
is there any code behind or just the javascript...

thank you
ray
0
Yana
Telerik team
answered on 07 Apr 2011, 12:36 PM
Hi Ray Merckel,

It's just the javascript as we're using client events in this case.

All the best,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TabStrip
Asked by
Josh
Top achievements
Rank 1
Answers by
Yana
Telerik team
Josh
Top achievements
Rank 1
Ray Merckel
Top achievements
Rank 2
Share this question
or