Tab
A newer version of this page is available. Switch to the current version.

NavBarGroup.Expanded Property

Gets or sets a value specifying whether the group is expanded.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(true)]
public bool Expanded { get; set; }
<DefaultValue(True)>
Public Property Expanded As Boolean

Property Value

Type Default Description
Boolean

true

true if the group is expanded, otherwise false.

Remarks

Use the Expanded property to expand and collapse groups. The expansion state of a group can be changed if the navbar's ASPxNavBar.AllowExpanding and the group's NavBarGroup.AllowExpanding properties are both set to true.

Examples

The full sample code can be obtained by using the How to create and load a NavBar group content on a callback example.

public partial class ASPxperience_LoadOnCallback : System.Web.UI.Page {
     protected void LoadGroupContent(NavBarGroup group) {
         Control control = null;
         if(group.Expanded && group.ContentTemplate == null) {
             switch(group.Name) {
                 case "Group1":
                 case "Group2":
                     control = LoadControl("UserControl.ascx");
                     break;
             }
             group.ContentTemplate = control as ITemplate;
         }
     }
     protected void LoadExpandedGroups() {
         for(int i = 0; i < ASPxNavBar1.Groups.Count; i++)
             LoadGroupContent(ASPxNavBar1.Groups[i]);
     }

     protected void Page_Load(object sender, EventArgs e) {
         LoadExpandedGroups();
     }
     protected void ASPxNavBar1_ExpandedChanged(object source, 
     DevExpress.Web.NavBarGroupEventArgs e) {
         LoadGroupContent(e.Group);
     }
}
See Also