Skip to main content
A newer version of this page is available. .
Tab

ASPxNavBar.ExpandedChanged Event

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

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

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