views:

33

answers:

2

When i am setting the tabcontainer first tab as active tab through javascript with the following code :

var tc = document.getElementById('<%= tabContainer.ClientID %>');
tc.firstChild.lastChild.style.visibility = "hidden";
tc.set_activeTabIndex(0);

i am getting the exception like:

Propert or method not supported with this object.

note that the second line succefully hides the second tab panel but the third line raises the excception

Any suggestion how to set a tab active through javascript?

A: 

Error is generated for line

tc.set_activeTabIndex(0);

We don't have built-in set_activeTabIndex() method.

You should apply appropriate CSS properties for enabling/disabling tabs.

pramodc84
no the secondline gets executed succefully infact i added the third line after successfully testing the second line
Rahat Ali
So error must be at third line
pramodc84
ye i know that the error is on third line but the set_activeTabIndex is not a supported method for tabcontainer why it raises the exception
Rahat Ali
A: 

You need the client control; not the DOM element. In order to get the control use the $find method. After that you can use the set_activeTab method.

ctrl = $find("<%= tabContainer.ClientID %>");
ctrl.set_activeTab(ctrl.get_tabs()[yourTabNumber]);
AlbertVanHalen
Then its seems not JavaScript related.
pramodc84
when i use var ctrl = $find("<%= tabContainer.ClientID %>"); ctrl.set_activeTab(ctrl.get_tabs()[yourTabNumber]);it return me object is null
Rahat Ali
Do you have a link to your webpage?
AlbertVanHalen