Skip to main content
Tab

ASPxButton.AutoPostBack Property

Gets or sets a value that specifies whether server-side processing is required to respond to a click on the button control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(true)]
public bool AutoPostBack { get; set; }

Property Value

Type Default Description
Boolean true

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

Remarks

Use the AutoPostBack property to control whether a predefined user action performed over the button (such as changing its checked state, for instance) can be completely processed on the client side by handling an appropriate client-side event (such as the ASPxClientButton.CheckedChanged 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 ASPxButton.CheckedChanged event).

Note that the available client-side events whose handlers are assigned in a button control are always fired regardless of the AutoPostBack property’s setting. The AutoPostBack property’s value only affects the default value of the ASPxClientProcessingModeEventArgs.processOnServer property which is passed to the editor’s specific client-side events (the AutoPostBack property passes its value to the processOnServer property).

If the AutoPostBack property is set to true, the end-user action is first processed via the corresponding client-side event (if its handler is assigned), and only after that is the server-side processing performed, if it has not been canceled by setting the client-side event’s processOnServer property to false. If the value of the AutoPostBack property is false, a specific user action which has a corresponding server-side event can still 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).

    Note

    Assigning a handler for a server event that relates to processing a click operation within a control (such as ASPxNavBar.ItemClick, for instance) changes the default value of the processOnServer property to true. So, invoking such events on the server does not depend on the AutoPostBack property setting and depends only on a developer not explicitly setting the processOnServer property to false in the corresponding client event’s handler.

Example

The complete sample project is available in the DevExpress Code Central database at E1120.

...
function popupControl_Init(s, e) {
    //Synchronize the client variable's value with the confirm dialog checkbox' setting
    dontAskConfirmation = cbDontAsk.GetChecked();
}

function ShowPopup(rowId) {
    //Assign the row's ID value to a specific label within the confirmation dialog, 
    //show the dialog, and set focus to the Yes button
    lbRowId.SetText(rowId);
    popupControl.Show();
    btnYes.Focus();
}

function btnYes_Click(s, e) {
    ClosePopup(true);
}

function btnNo_Click(s, e) {
    ClosePopup(false);
}

function cbDontAsk_CheckedChanged(s, e){
    //Synchronize the client variable's value with the confirm dialog checkbox' 
    //setting, and focus the Yes button
    dontAskConfirmation = cbDontAsk.GetChecked();
    btnYes.Focus();
}
...

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AutoPostBack property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also