TabBase.Visible Property
Gets or sets a value specifying the visibility of the current tab (tab page).
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | true |
|
Remarks
Use the Visible property of tabs (tab pages) to dynamically change the content of a tab control (page control). This property enables you to hide and display specific tabs (tab pages) when certain conditions are met.
Note that the Visible and TabBase.VisibleIndex properties are interdependent. A false
value assigned to the Visible property sets the TabBase.VisibleIndex property to -1. Setting the Visible property back to true
sets the TabBase.VisibleIndex property to the non-negative value it previously had.
Note
If you toggle a tab page’s Visible property via code, it changes the control’s child controls hierarchy. In this case, you should set the ASPxPageControl.EnableHierarchyRecreation property to true
; otherwise, the ASPxPageControl may function improperly.
Note
If a tab’s server Visible property is set to false
, the tab is not rendered into the web page at all, so it can’t be manipulated on the client side.
Example
The following example shows how the tab page's visibility can be changed via code. Note that the EnableHierarchyRecreation property should be set to true.
Note
To change a tab page’s visibility use the TabBase.Visible
property rather than modification the tab page collection using TabPageCollection.Add, TabPageCollection.Remove, or Collection.RemoveAt methods.
protected void Page_Load(object sender, EventArgs e)
{
// Initially hide the second tab page
if (!IsPostBack && !IsCallback) {
ASPxPageControl1.TabPages[1].Visible = false; // do not use ASPxPageControl1.TabPages.RemoveAt(1)!
}
}
protected void ASPxRadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) {
// Hide a tab page corresponding to the selected radio button
for (int i = 0; i < ASPxPageControl1.TabPages.Count; i++) {
ASPxPageControl1.TabPages[i].Visible = true;
}
ASPxPageControl1.TabPages[ASPxRadioButtonList1.SelectedIndex].Visible = false;
}