我知道如何隐藏标签:
MyTabContainerID.Tabs[1].Visible = false;
这样可行。我遇到的问题是更改由 radioButtonList selectedIndexChanged 事件的回发触发的选项卡的可见性。
当页面到达我的 selectedIndexChanged 事件处理程序时,选项卡已经从 ViewState 加载了 Visible=True。我可以在我的 selectedIndexChanged 事件中整天将其更改为 false,它不会隐藏它已经加载的选项卡 b/c。
ASPX
<asp:RadioButtonList ID="rblMyRadioButtonList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblMyRadioButtonList_SelectedIndexChanged">
<asp:ListItem Text="Yes" Value="True" Selected="True"></asp:ListItem>
<asp:ListItem Text="No" Value="False"></asp:ListItem>
澳交所
protected void Page_Init(object sender, EventArgs e)
{
try
{
MyTabContainerID.Tabs[1].Visible = Tab1Visibility;
}
catch (Exception ex)
{
common.alert("Error in PageName.Page_Init.<br>ERROR=" + ex.Message);
}
}
protected void rblMyRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
Tab1Visibility = Convert.ToBoolean(((RadioButtonList)sender).SelectedValue);
MyTabContainerID.Tabs[1].Visible = Tab1Visibility; //BY THE TIME THIS HAPPENS IT'S ALREADY ON THE PAGE WITH VISIBLE=TRUE
}
catch (Exception ex)
{
common.alert("Error in PageName.rblMyRadioButtonList_SelectedIndexChanged.<br>ERROR=" + ex.Message);
}
}
protected bool Tab1Visibility
{
get { return (bool)Session["ses_bTab1Visibility"]; }
set { Session["ses_bTab1Visibility"] = value; }
}
想法?建议?