Monday, March 26, 2012

Change active tab in Ajax tab container using javascript

I have been using the ajax tab control. I need to change the active tab index of the tab container through javascript.

Can please anyone tell me how can i do it

Cheers

Sohail Sayed

Hi,

you can use the following javascript function to set the active tab:

function SetActiveTab(tabControl, tabNumber)
{
var ctrl = $find(tabControl);
ctrl.set_activeTab(ctrl.get_tabs()[tabNumber]);
}

tabControl: ID from the TabContainer Controls
tabNumber: Number of the new Tab (starting at 0)

Regards
Marc André


Thanks Marc,

I did it and it works good

$find('<%=TabContainer1.ClientID%>').get_activeTabIndex();

and

$find('<%=TabContainer1.ClientID%>').set_activeTabIndex(2);

thnx for the reply

Cheers

Sohail SayedP>


Hi ,

I have a similiar issue with the post back under tab container.

I have tried to use the Java script u mentioned..

but no luck so far.

I have couple of tab panels inside a tab container. Each tab panel got a few data controls in it, which loads on post back.

But on page load it keep on going to the first tab.

Alternatively, once i clicked the button control inside any tab, it is showing that tab after it been clicked.

any suggesstion to work this out will be much appreciated.

Thanks in advance..

Cheers,

Barti...

No comments:

Post a Comment