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

Go back to top of page after changing selected tab / pageview

1 Answer 79 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Steve LaForge
Top achievements
Rank 1
Steve LaForge asked on 22 Sep 2010, 09:39 PM
I have a page using a master page.  The content page includes a tabstrip and multipage combo.  I have created a wizard (based on the sample) where the user fills out part of a form and then clicks on a "Next" button to progress to the next pageview.  The user can not navigate via the tabstrip and serves only as an indicator of the user's progress towards completing the form.

The tabstrip and multipage are contained in a RadAjaxPanel.

Unfortunately some of the forms in each of the views can be pretty lengthy.  When the user clicks on the next button, the pageview changes as desired but it remains scrolled down to the point where the button appeared.  How can I make the page scroll back to the top each time the active pageview changes?

Thanks!!!

1 Answer, 1 is accepted

Sort by
0
Steve LaForge
Top achievements
Rank 1
answered on 22 Sep 2010, 10:11 PM
Ahhh....I found an answer!

On my RadAjaxPanel, I added the "ClientEvents-OnRequestStart" to call a JavaScript client-side function called "conditionalPostback":
<telerik:RadAjaxPanel runat="server" ID="radAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" ClientEvents-OnRequestStart="conditionalPostback">

Then, in my Javascript code, I have:

function conditionalPostback(sender, args) {
  if (args.get_eventTarget() == "<%= btnNext.UniqueID %>" ||
    args.get_eventTarget() == "<%= btnNext2.UniqueID %>" ||
    args.get_eventTarget() == "<%= btnNext3.UniqueID %>" ||
    args.get_eventTarget() == "<%= btnSubmit.UniqueID %>") {
     window.scrollTo(0,0);
    }
}

Someone may have a better solution, but this one definitely works for me at this point.


Tags
TabStrip
Asked by
Steve LaForge
Top achievements
Rank 1
Answers by
Steve LaForge
Top achievements
Rank 1
Share this question
or