Showing posts with label active. Show all posts
Showing posts with label active. Show all posts

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...

Catch the active tab changed event in javascript

Hi,

I have been using the ajax tab control.

I need to catch the activetab changed event of javascript.

I want to do some processing when the users goes to a specific tab.

It would be very helpful if someone can tell me how i can do it.

Cheers

Sohail

Hi,

Well looks like i got how to catch the activetab changed event

the tab container has OnClientActiveTabChanged event.

However i still need to get some way to acces the active index in the javascript so based on it i can do some processing.

Please let me know the soltn

Cheers

Sohail Sayed


Hi Sohail,

You can use the following script to get the index of active tab:


var tc = $find("TabContainer1"); // "TabContainer1" is the client id of the TabContainer control.

var index = tc.get_activeTabIndex();

Hope this helps.


Hi,

Thx i am now able to get the active index