AutoCompleteBoxPropertiesBase.EnableSynchronization Property
Gets or sets whether to update the Items collection on the server once you add or remove an item on the client.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
[DefaultValue(DefaultBoolean.Default)]
public DefaultBoolean EnableSynchronization { get; set; }
Property Value
Type | Default | Description |
---|---|---|
DefaultBoolean | Default | One of the enumeration values. |
Available values:
Name | Description | Return Value |
---|---|---|
True | The value is true. |
|
False | The value is false. |
|
Default | The value is specified by a global option or a higher-level object. |
|
Remarks
Note
The EnableSynchronization
properties of ComboBoxExtension and TokenBoxExtension have no effect.
You can enable client-side API members of a list editor to add and remove list items on the client. Due to security reasons, list editors do not update their server-side Items collection in response to client-side item modifications. Refer to the following topic for more information: Validation in List Editors.
Follow the steps below to enable item synchronization in a list editor:
- Make sure that the DataSecurityMode property is set to
Default
. - Make sure that the EnableCallbackMode property is set to
False
(the default value). - Set the
EnableSynchronization
property toTrue
.
When the EnableSynchronization
property is set to Default
, the ListEditEnableSynchronizationDefaultValue setting specifies whether item synchronization is enabled.
The following example enables item synchronization for the combo box editor:
<dx:ASPxComboBox ID="ASPxComboBox" runat="server" EnableSynchronization="True">
<Items>
<dx:ListEditItem Text="Item 1" Value="Item 1" />
<dx:ListEditItem Text="Item 2" Value="Item 2" />
<dx:ListEditItem Text="Item 3" Value="Item 3" />
</Items>
</dx:ASPxComboBox>
Item Synchronization Specifics
Item synchronization has the following specifics:
- Synchronization does not affect the bound data source. Update the data source manually to prevent data loss.
- You should populate the list editor with items before the editor synchronizes item collections for the first time. To do this, specify the Items collection in markup or add items during editor or page initialization (
Init
orPage_Init
events). - ItemInserting and ItemDeleting events allow you to cancel item insert and delete operations. Handle ItemInserted and ItemDeleted events to respond to item collection modifications.
Important
When item synchronization is enabled, ensure that the editor encodes its property values. Otherwise, your application may be vulnerable to cross-site scripting (XSS) attacks. Refer to the following topic for more information: HTML Encoding.