Back to Devexpress

ASPxNavBar.AutoPostBack Property

aspnet-devexpress-dot-web-dot-aspxnavbar-73ef809d.md

latest5.1 KB
Original Source

ASPxNavBar.AutoPostBack Property

Gets or sets a value that specifies whether server-side processing is required for specific predefined user actions.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(false)]
public bool AutoPostBack { get; set; }
vb
<DefaultValue(False)>
Public Property AutoPostBack As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true, if server-side processing is required, otherwise, false.

|

Remarks

Use the AutoPostBack property to control whether a predefined user action (such as a group’s expansion state change, for instance) can be completely processed on the client side by handling an appropriate client-side event (such as the ASPxClientNavBar.ExpandedChanging in this instance) or a round trip to the server is required so that the action is finally processed on the server side with the help of the corresponding server-side event (such as the ASPxNavBar.ExpandedChanging event).

Note that the available client-side events whose handlers are assigned in a navbar control are always fired regardless of the AutoPostBack property’s setting. The AutoPostBack property’s value only affects the default value of the processOnServer property which is passed to the navbar’s specific client-side events. If the AutoPostBack property is set to true the end-user action is first of all processed via the corresponding client-side event and only after that the server-side processing is performed if it has not been canceled via the setting of the client-side event’s processOnServer property. If the value of the AutoPostBack property is false, a specific user action which has a corresponding server-side event can all the same be processed on the server side by setting the processOnServer property to true in the client event’s handler.

In such a way, note that server-side events which correspond to specific performed user actions may not be generated in the following two cases:

  • The AutoPostBack property is set to true, but the corresponding client-side event is handled so that the processOnServer property is set to false.
  • The AutoPostBack property is set to false and the corresponding client-side event is not handled, or handled so that the processOnServer property is not changed (is not set to true).

Example

csharp
using DevExpress.Web.ASPxNavBar;
...

protected void Page_Load(object sender, EventArgs e) {
     ASPxNavBar ASPxNavBar1 = new ASPxNavBar();
     ASPxNavBar1.AutoPostBack = true;
     ASPxNavBar1.ShowExpandButtons = false;
     ASPxNavBar1.GroupHeaderStyle.HorizontalAlign = HorizontalAlign.Left;
     ASPxNavBar1.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

     NavBarGroup group1 = new NavBarGroup("Group1");
     NavBarGroup group2 = new NavBarGroup("Group2");

     NavBarItem item1 = new NavBarItem("Item1");
     NavBarItem item2 = new NavBarItem("Item2");
     NavBarItem item3 = new NavBarItem("Item3");

     ASPxNavBar1.Groups.Add(group1);
     ASPxNavBar1.Groups.Add(group2);

     group1.Items.Add(item1);
     group2.Items.Add(item2);
     group2.Items.Add(item3);

     group1.HeaderStyle.BackColor = System.Drawing.Color.White;
     group2.HeaderStyle.BackColor = System.Drawing.Color.Red;

     Page.Form.Controls.Add(ASPxNavBar1);       
}
vb
Imports DevExpress.Web.ASPxNavBar
... 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
     Dim ASPxNavBar1 As New ASPxNavBar()
     ASPxNavBar1.AutoPostBack = True
     ASPxNavBar1.ShowExpandButtons = False
     ASPxNavBar1.GroupHeaderStyle.HorizontalAlign = HorizontalAlign.Left
     ASPxNavBar1.ItemStyle.HorizontalAlign = HorizontalAlign.Center

     Dim group1 As New NavBarGroup("Group1")
     Dim group2 As New NavBarGroup("Group2")

     Dim item1 As New NavBarItem("Item1")
     Dim item2 As New NavBarItem("Item2")
     Dim item3 As New NavBarItem("Item3")

     ASPxNavBar1.Groups.Add(group1)
     ASPxNavBar1.Groups.Add(group2)

     group1.Items.Add(item1)
     group2.Items.Add(item2)
     group2.Items.Add(item3)

     group1.HeaderStyle.BackColor = System.Drawing.Color.White
     group2.HeaderStyle.BackColor = System.Drawing.Color.Red

     Page.Form.Controls.Add(ASPxNavBar1)
End Sub

See Also

Navigation Bar

ASPxNavBar Class

ASPxNavBar Members

DevExpress.Web Namespace