Ticket Q303458
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

ASPxListBox synchronization with server on ASPxCallback

ASPxListBox loses items during ASPxCallbackPanel's callback

created 14 years ago

I am populating a listbox on a callback like this
    Protected Sub ddlUnmappedFields_Callback(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxClasses.CallbackEventArgsBase) Handles ddlUnmappedFields.Callback
                Using ds As New DataSet
                    ds.ReadXml("c:\test" & ddlSystems.Value & "" & ddlRuns.Value)
                    Dim alUnmapped As New ArrayList
                    For Each dc As DataColumn In ds.Tables("Historical").Columns
                        If Not dc.ColumnName.Equals("DataID") And Not dc.ColumnName.Equals("DataDate") And Not dc.ColumnName.Equals("Recipe") Then
                            Dim li = ddlMappedFields.Items.FindByText(dc.ColumnName)
                            If li Is Nothing Then
                                alUnmapped.Add(dc.ColumnName)
                            End If
                        End If
                    Next
                    alUnmapped.Sort()
                    With ddlUnmappedFields
                        .Items.Clear()
                        .DataSource = alUnmapped
                        .DataBindItems()
                    End With
                End Using
    End Sub
The items show up in the listbox fine. This listbox is in a callback panel with several other controls and when a perform a callback on the panel there are no items listed.

Comments (1)

    Hello Patrick,
    When you perform ASPxCallbackPanel's callback, it is necessary to re-bind the ASPxListBox control with the last callback parameter to restore the Items collection (since it has been created by ASPxListBox's callback). For example, you can create a special method, which accepts the ASPxListBox instance and the callback parameter and call this method from the ASPxListBox's Callback event handler and from the ASPxCallbackPanel's Callback event handler.
    To resolve this issue, it is also possible to use the approach, illustrated in the ASPxListBox synchronization with server on ASPxCallback report.
    Thanks,
    Mike

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.