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

Saving Scroll Position of Scheduler

2 Answers 51 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 10 Jun 2008, 06:29 PM
Simply stated, I have a web page with 2 tabs.  One tab has the scheduler control and another tab has a text control that uses an asp timer control to update the text.  The issue my users are having is that they scroll down to an appointment later on in the day and then click on the other tab to look at the text box.  When they click back to the scheduler tab, the timer has fired(creating a postback) and the scheduler is scrolled back to the beginning of the day.  Is there a way to save the scroll position of the scheduler so I can restore it once the user clicks back to the schedulers tab?

2 Answers, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 12 Jun 2008, 07:19 AM
Hi Michael

I read this earlier, it sounds very similar to what you want. Have a look and see if it helps

http://mattberseth.com/blog/2008/06/aspnet_ajax_creating_reusable.html
0
Michael
Top achievements
Rank 1
answered on 12 Jun 2008, 05:15 PM
Thanks, Jonathan.

I used a slight modification of that code to get it working.  Here's what I did:

        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true"
            LoadScriptsBeforeUI="false" ScriptMode="Release">
        </asp:ScriptManager>
<script type="text/JavaScript">
var xWeeklyPos, yWeeklyPos, xDailyPos, yDailyPos;
var prm = Sys.WebForms.PageRequestManager.getInstance();

function BeginRequestHandler(sender, args)
{
    if($get('<%= RadSchedWeekly.ClientID %>') != null)
    {
        xWeeklyPos = $get('<%= RadSchedWeekly.ClientID %>').childNodes(1).scrollLeft;
        yWeeklyPos = $get('<%= RadSchedWeekly.ClientID %>').childNodes(1).scrollTop;   
    }

    if($get('<%= RadSchedDaily.ClientID %>') != null)
    {
        xDailyPos = $get('<%= RadSchedDaily.ClientID %>').childNodes(0).scrollLeft;
        yDailyPos = $get('<%= RadSchedDaily.ClientID %>').childNodes(0).scrollTop;   
    }   
}

function EndRequestHandler(sender, args)
{
    if($get('<%= RadSchedWeekly.ClientID %>') != null)
    {
        $get('<%= RadSchedWeekly.ClientID %>').childNodes(1).scrollLeft = xWeeklyPos;
        $get('<%= RadSchedWeekly.ClientID %>').childNodes(1).scrollTop = yWeeklyPos;  
    }
   
    if($get('<%= RadSchedDaily.ClientID %>') != null)
    {
        $get('<%= RadSchedDaily.ClientID %>').childNodes(0).scrollLeft = xDailyPos;
        $get('<%= RadSchedDaily.ClientID %>').childNodes(0).scrollTop = yDailyPos;  
    }   
}

prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
</script>     

It works perfectly.....
Tags
Scheduler
Asked by
Michael
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or