How do I delete the bindings from a list box. My code fails at:
my code fails as the list box is already binded.
How do I clear this to create a new binding so that my list box will sort?
Code:
Dim i As Integer = objAddTo.Items.Count
Dim SortListA As ArrayList
Dim j As Integer
Do While i > 0
If objAddTo.Items.Item(i - 1).Selected = True Then
Me.objRemoveFrom.Items.Add(Me.objAddTo.Items.Item(i - 1))
objAddTo.Items.Remove(objAddTo.Items.Item(i - 1))
'Sort list boxes
SortListA = New ArrayList
'Me.objRemoveFrom.DataSource = SortListA
For j = 0 To objRemoveFrom.Items.Count - 1
SortListA.Add(objRemoveFrom.Items(j).Value)
Next 'j
objRemoveFrom.DataSource = SortListA
'Fails here
objRemoveFrom.DataBind()
Session("SortA") = SortListA
Session("SortA").sort()
End If
i -= 1
Loop
my code fails as the list box is already binded.
How do I clear this to create a new binding so that my list box will sort?