Even though I feel like I've tackled this issue in the past, I can't seem to locate a resolution anywhere...
In my situation, there are 3 tabs within an ajax TabContainer and two CheckBoxes located outside of it. All 3 tabs are visible unless both CheckBoxes remain unchecked - at that point, the 3rd tab should be hidden.
I have managed to show/hide using javascript whenever the checkbox values change:
$find('<%=OptionsTabs.ClientID%>').get_tabs()[2]._hide();
$find('<%=OptionsTabs.ClientID%>').get_tabs()[2]._show();
Yet, during PageLoad, I'm struggling to achieve similar results with C#. I attempted adjusting display and visibility properties, only to find that the tab remained visible. The only method that successfully hid the tab was setting Visible=false, but doing so prevented the tab from being rendered at all and thus couldn't be shown via javascript later on.
UPDATE: I tested embedding the same script during PageLoad, still without success.
string script = "<script type=text/javascript> $find('<%=OptionsTabs.ClientID%>').get_tabs()[2]._hide(); </script>";
ClientScriptManager cs = Page.ClientScript;
String csname1 = "TabScript";
Type cstype = this.GetType();
cs.RegisterStartupScript(cstype, csname1, script);
The issue lies in OptionsTabs being null at this point.
I experimented by passing the ClientID obtained server-side. I tried substituting the tab name for the tab container name. I also attempted modifying the display/visibility properties of the tab and its header. Unfortunately, none of these approaches yielded positive outcomes.