Enabling/Disabling a Tab in a TabStrip

Y

Yuki

Hi all!
I put a TabStrip in my webform, and, in some events, I need to disable some
Tabs in the TabStrip... I try this:
Microsoft.Web.UI.WebControls.Tab t;
t = (Microsoft.Web.UI.WebControls.Tab)this.mpMy.FindControl("tab1");

but I have a error:
Cannot convert type 'System.Web.UI.Control' to
'Microsoft.Web.UI.WebControls.Tab'

any ideas?

TIA, Yuki!
 
C

CaffieneRush

I cannot see that Tab is the child or descendent class of
System.Web.UI.Control.
It's inheritance goes like this, Object->BaseChildNode->TabItem->Tab.
So you cannot use FindControl() for locating a Tab at runtime.

However TabStrip does inherit from Control so you can use FindControl
to locate that and examine it's Items collection for your tab, then
disable your tab.

Regards.
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top