Tweaking AJAX Tab Panel Preservation

P

Plateriot

I have several pages that have 3 tabs.
One of the desired effects is to preserve whatever tab the user may have
selected from page-to-page.
So I use the following Client-Side script to remember a Tab that the user
selects. I can then preserve it and use the number to switch to the same tab
on another page:

<script type="text/javascript">
function PanelClick(sender, e) {
}

function ActiveTabChanged(sender, e) {
// use the client side active tab changed
// event to trigger a callback thereby
// triggering the server side event.
__doPostBack('<%= tabs.ClientID %>',
sender.get_activeTab().get_headerText());
}

</script>

I combine that client-side script with this code-behind:

Protected Sub Tabs_ActiveTabChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
Session("ssTab") = Me.Tabs.ActiveTabIndex
End Sub


and then in the Load_Event of the page in question:

'return whatever tab the user has selected
Me.Tabs.ActiveTabIndex = Session("ssTab")


The problem with this, particularly if the page is data intensive, is that
there is a significant delay before the client-side script kicks off and does
the 'post-back'
so, for example, the user sees the page presented when they click the tab,
but a couple of seconds later - it does the postback (just so that the server
side can record whatever tab the user selected)

How can I tweak this to get the best desired outcome -
which is:
1) preserve the tab index when the user clicks it
2) use that index on other pages - but WITHOUT a tacky postback mid-viewing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top