Saturday, March 24, 2012

Tab Panel Problems

Hello Everyone,

I am using the tab panel that came with the AJAX Toolkit basically the same as the sample Tab Panel. I'm using OnPrerender to show dynamic content on the tab panels (based on what the user enters on the first panel). My problem is that all the panels are being filled even though they are not currently active and may never be selected by the user. Onprerender calls a C# function which determines content for each individual panel. There is a separate function for each separate panel (in C#). What code can I add so I can prevent the C# function from being called until they actually click on that particular Tab? If you need to see the site to understand the problem better you can go towww.visual-search.net and try a sample search. The problem will be obvious I think. Thank you in advance.

Robert

Hi Robert,

To load data for only the currently Visible Tab , you can subscribe to the "ActiveTabChanged" Event on the Server-Side and depending on the

Current ActiveTabIndex , you can

Unfortunately, there are some issues with this property .

There is a work-Item opened to track this

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7739

Jason Hill has a work-around for this Property which is also mentioned in the WorkItem .

For clarity , I will repeat it here.

<blurb>

JasonHill wroteMar 15 at 11:23 PM

You can workaround this by creating a JS function:

function ActiveTabChanged(sender, e)
{
__doPostBack('<%= TabContainer.ClientID %>', sender.get_activeTab().get_headerText());
}

and then assigning this as the event handler for a client tab change in the tab container:

OnClientActiveTabChanged="ActiveTabChanged"

Looking forward to the autopostback property though!

</blurb>

Hope this helps

No comments:

Post a Comment