Skip to main content
A newer version of this page is available. .
Tab

ListBoxProperties.EnableSynchronization Property

Gets or sets a value that specifies whether client manipulations with the editor’s list items (adding, deleting) should be synchronized with the editor’s server Items collection.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(DefaultBoolean.Default)]
public DefaultBoolean EnableSynchronization { get; set; }

Property Value

Type Default Description
DefaultBoolean **Default**

One of the DefaultBoolean enumeration values.

Available values:

Name Description
True

Corresponds to a Boolean value of true.

False

Corresponds to a Boolean value of false.

Default

The value is determined by the current object’s parent object setting (e.g., a control setting).

Remarks

If the ASPxEditBase.EnableClientSideAPI property is set to true, you are allowed to manipulate the editor’s list items on the client side by using specific client methods (such as the ASPxClientListBox.AddItem, ASPxClientListBox.RemoveItem, etc). The EnableSynchronization property controls whether such client item manipulations should be synchronized with the server ASPxListEdit.Items collection of the editor.

Note

An ASPxListBox must have its ASPxListEdit.Items collection bound by the time synchronization occurs. So, you should provide the ASPxListBox with items using its Init or Page_Init event handler.

Note that the synchronization does not modify a data source, so you should do it manually to prevent losing your data.

Note that if the EnableSynchronization property is set to DefaultBoolean.Default, the item synchronization’s availability depends upon the ASPxListBox.EnableCallbackMode property setting: if ASPxListBox.EnableCallbackMode is set to DefaultBoolean.False, the item synchronization is available; otherwise, it is disabled.

If the EnableSynchronization property is enabled and the ASPxListBox.DataSecurityMode property is set to the Default value, a list editor allows adding new list items via client code and synchronizes modifications to this list with the server ASPxListEdit.Items collection. In this scenario, it is recommended to HTML encode the editor item’s content using the following:

  • enable the EditPropertiesBase.EncodeHtml property if items aren’t created using templates.
  • encode HTML using the HttpUtility.HtmlEncode method if items are created using templates (ASPxListBox.ItemTemplate).

    
    <dx:ASPxListBox ID="lb1" runat="server">
        <ItemTemplate>
            <asp:Label ID="Label1" runat="server" Text='<%# HttpUtility.HtmlEncode(Eval("Text")) %>'></asp:Label>
        </ItemTemplate>
    </dx:ASPxListBox>
    

Note

The EnableSynchronization property synchronizes its value with the editor’s ASPxListBox.EnableSynchronization property.

See Also