Home All Groups Group Topic Archive Search About

Enabling/Disabling a Tab in a TabStrip

Author
31 Mar 2006 8:27 PM
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!

Author
31 Mar 2006 10:59 PM
sirfunusa
Wrap this in CType
Author
1 Apr 2006 8:03 AM
CaffieneRush@gmail.com
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.