aspnet-devexpress-dot-web-dot-navbargroup-e0901b36.md
Gets or sets a value specifying whether the group is expanded.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue(true)]
public bool Expanded { get; set; }
<DefaultValue(True)>
Public Property Expanded As Boolean
| Type | Default | Description |
|---|---|---|
| Boolean | true |
true if the group is expanded, otherwise false.
|
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.
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);
}
}
Partial Public Class ASPxperience_LoadOnCallback
Inherits System.Web.UI.Page
Protected Sub LoadGroupContent(ByVal group As NavBarGroup)
Dim control As Control = Nothing
If group.Expanded AndAlso group.ContentTemplate Is Nothing Then
Select Case group.Name
Case "Group1", "Group2"
control = LoadControl("UserControl.ascx")
End Select
group.ContentTemplate = TryCast(control, ITemplate)
End If
End Sub
Protected Sub LoadExpandedGroups()
For i As Integer = 0 To ASPxNavBar1.Groups.Count - 1
LoadGroupContent(ASPxNavBar1.Groups(i))
Next i
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
LoadExpandedGroups()
End Sub
Protected Sub ASPxNavBar1_ExpandedChanged(ByVal source As Object, ByVal e As DevExpress.Web.NavBarGroupEventArgs)
LoadGroupContent(e.Group)
End Sub
End Class
See Also