ASPxListBox.Callback Event
Fires when a round trip to the server has been initiated by a call to the client ASPxClientListBox.PerformCallback method.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Event Data
The Callback event's data class is CallbackEventArgsBase. The following properties provide information specific to this event:
Property | Description |
---|---|
Parameter | Gets a string that contains specific information (if any) passed from the client side. |
Remarks
The Callback
event allows any desired server-side processing to be performed in response to a call to the client PerformCallback(parameter) method, and the editor’s content being updated, as required.
Specific information passed from the client side can be obtained via the Parameter property.
Note that the necessary actions can be additionally performed on the client side before and after callback processing by using the BeginCallback and EndCallback client event.
Note
The ASPxListBox control allows you to modify the Items collection on callbacks only (e.g. add and remove items, populate the controls with new data from a data source, etc.).
It is not possible, for example, to modify a column collection, change items selection, or change SelectionMode on callbacks. To perform these actions on the client side, you can wrap the control with the ASPxCallbackPanel control and process a required scenario on a callback to the panel.
After the PerformCallback
method is called on the client, the Callback
event handler is raised during each page postback. You can use the IsCallback property to determine if the PerformCallback
method raises the event.
protected void ASPxListBoxInstance_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e) {
DevExpress.Web.ASPxEditors.ASPxListBox cmb = (DevExpress.Web.ASPxEditors.ASPxListBox)sender;
if(cmb.IsCallback) {
//Raised by PerformCallback
}
//else //Raised by Postback
}
Example
This part of the Multiple Selection demo illustrates how to use multi-selection mode for the ASPxListBox editor.
<dx:ASPxListBox ID="lbFeatures" runat="server" SelectionMode="CheckColumn" Height="210px"
DataSourceID="Features" ValueField="ID" ValueType="System.String" TextField="Name">
<ClientSideEvents SelectedIndexChanged="function(s, e) {lbModels.PerformCallback('1');}" />
</dx:ASPxListBox>
<dx:ASPxListBox ID="lbModels" runat="server" SelectionMode="CheckColumn"
Height="210px" width="250px" ClientInstanceName="lbModels"
DataSourceID="PhoneModels" ValueField="ID" ValueType="System.String"
OnCallback="lbModels_Callback" >
<Columns>
<dx:ListBoxColumn FieldName="Name" Caption="Model" width="100%"/>
<dx:ListBoxColumn FieldName="Price" width="50px"/>
</Columns>
</dx:ASPxListBox>
protected void lbModels_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e) {
FilterModels(lbFeatures.Items);
lbModels.DataBind();
}
protected void FilterModels(ListEditItemCollection items) {
...
}
...