Skip to main content
Tab

ASPxNavBar.ExpandedChanged Event

Fires on the server side after a group’s expansion state has been changed.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public event NavBarGroupEventHandler ExpandedChanged

Event Data

The ExpandedChanged event's data class is NavBarGroupEventArgs. The following properties provide information specific to this event:

Property Description
Group Gets a group for which the event is fired.

Remarks

Write an ExpandedChanged event handler to perform specific actions on the server side each time after a group’s expansion state has been changed. You can use the event parameter’s NavBarGroupEventArgs.Group property to identify the group which has been expanded or collapsed.

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