This topic is locked

Disable Tabs

12/2/2011 9:06:51 PM
ASPRunnerPro General questions
T
TechArt author

Hello ,
I need to know how to disable ( TAB ) in Add/Edit Page based on Combo Box ??
As Example , let say we have Add page with 3 Tabs , in the first tab we have combobox with 2 option ,

the first option enable tab no.2 & disable tab no.3

the second option disable tab no.2 & enable tab no.3
I'm using ASPrunner V 6.3
Hope to have advise about that matter .
Thanks,

Sergey Kornilov admin 12/5/2011
K
Kevin 12/13/2011

The TabPage class doesn't have an Enable property. You can get a similar effect simply by setting the Enable property of the controls on that page. That also avoids the problem of dealing with a TabControl that has only one page. For example:
public static void EnableTab(TabPage page, bool enable) {

EnableControls(page.Controls, enable);

}

private static void EnableControls(Control.ControlCollection ctls, bool enable) {

foreach (Control ctl in ctls) {

ctl.Enabled = enable;

EnableControls(ctl.Controls, enable);

}

}