ASPxPageControl.EnableHierarchyRecreation Property
Gets or sets a value that specifies whether the page control enables its control hierarchy to be forcibly recreated, to apply the settings defined at runtime to its child controls.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | true |
|
Remarks
When you modify the ASPxPageControl‘s properties programmatically at runtime, the ViewState is utilized to remember the state change. Across a postback, the control hierarchy is recreated. After that, the page’s view state is applied.
If the control settings are modified, changing the child controls hierarchy (e.g. toggle a tab page’s TabBase.Visible property via code), the hierarchy must be recreated again after the ViewState is loaded; otherwise, the control may function improperly.
Set the EnableHierarchyRecreation property to true
, to forcibly recreate the control hierarchy after the ViewState is loaded (after a postback).
Note
Set the EnableHierarchyRecreation property in a markup or at runtime in the page’s Init event (before the ViewState is loaded).
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;
}