asp.net ajax控件选项卡控件的选项卡的动态显示与隐藏问题

时间:2021-08-18 12:52:08

if (dq_gly.Yhm != "admin")
{
this.TabContainer1.Tabs[0].Visible = false;
this.TabContainer1.Tabs[1].Visible = false;
this.TabContainer1.Tabs[2].Visible = false;
this.TabContainer1.Tabs[4].Visible = false;
this.TabContainer1.Tabs[3].Visible = true;
this.TabContainer1.ActiveTabIndex = 3;//必须激活,否则只有一个选项卡时,仍然全部选项卡都不显示;当有2个以上选项卡可视时,系统默认有一个被自动激活。当只有一个选项卡可视时,系统不知道激活哪个
}
else
{
this.TabContainer1.Tabs[0].Visible = true;
this.TabContainer1.Tabs[1].Visible = true;
this.TabContainer1.Tabs[2].Visible = true;
this.TabContainer1.Tabs[4].Visible = true;
this.TabContainer1.Tabs[3].Visible = true;
}