Binding to Large Data (Database Server Mode)

  • 2 minutes to read

The ASPxComboBox, ASPxTokenBox and ASPxListBox controls support database server mode. In this mode, list editors load only required (visible) items to the server memory and implement data-aware operations (for example, filtering) at the database level.

Bind a list editor to a LinqServerModeDataSource or EntityServerModeDataSource and set the editor's EnableCallbackMode property to true to enable database server mode. When a user applies a filter to a combo box or list box, the editor loads the filtered data to the server memory and displays this data. You can also use the CustomFiltering event to implement a custom filter on the server in this mode.

TIP

Refer to the Members Table for a list of available API.

ASPxGridView_DataBinding_ServerMode

<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" EnableCallbackMode="true" CallbackPageSize="10"
    ValueField="ID" TextFormatString="{0} {1} {2}" Width="287px" DropDownStyle="DropDown" DataSourceID="EntityServerModeDataSource">
    <ClientSideEvents BeginCallback="function(s, e) { OnBeginCallback(); }" EndCallback="function(s, e) { OnEndCallback(); } " />
    <Columns>
        <dx:ListBoxColumn FieldName="FirstName" />
        <dx:ListBoxColumn FieldName="LastName" />
        <dx:ListBoxColumn FieldName="Phone" />
    </Columns>
</dx:ASPxComboBox>
<dx:EntityServerModeDataSource ID="EntityServerModeDataSource" runat="server" 
ContextTypeName="DevExpress.Web.Demos.LargeDatabaseContext" TableName="Persons" />
NOTE

In database server mode, the ValueType property and the data type of the editor's value should be of the same type.

Online Demo

Large Database: Server Mode

Members Table

The table bellow lists APIs that DevExpress MVC List Editors use when working with large data sets in database server mode.

Class

API

ASPxComboBox

ASPxAutoCompleteBoxBase.EnableCallbackMode

ASPxAutoCompleteBoxBase.CustomFiltering

ASPxTokenBox

ASPxAutoCompleteBoxBase.EnableCallbackMode

ASPxAutoCompleteBoxBase.CustomFiltering

ASPxListBox

ASPxListBox.EnableCallbackMode

ASPxListBox.CustomFiltering

Database Server Mode Limitations

In database server mode, list editors transform filter expressions (Criteria language syntax) to SQL requests. If list editors (in multi-column mode) use the TextFormatString property, the filter expression ignores the "alignment" and "format string" format parameters.

The following table illustrates how the editor converts its format string in regular data binding mode and database server mode:

Regular Data Binding Database Server Mode
"{0:d} from {1,2:n}" "{0} from {1}"

Handle the Customfiltering server-side event and specify the ListEditCustomFilteringEventArgs.FilterExpression property to use format string functionality to filter list editor items. Refer to the Members Table for a list of available API.