I am having a problem binding a child list to these 2 and then persisting list changes to the database. i run into an edit lvl problem. Is there a proper way to do the binding? I have no problem creating filteredbinglists or sortedbindinglists, but i suspect the problem is when i should bind them to the form. I apply the filter to the bindinglist some clicks away using a button and then rebinding properly
Dim FLTVPELATES As Csla.FilteredBindingList(Of SINALLASOMENOI_EC)
Dim strlist As Csla.SortedBindingList(Of SINALLASOMENOI_EC)Public Sub New(ByVal GEF As GEFYRA1)
InitializeComponent()
mGEFYRA = GEF
BindUI()
End SubPrivate
Sub BindUI()mGEFYRA.BeginEdit()
FLTVPELATES = New Csla.FilteredBindingList(Of SINALLASOMENOI_EC)(mGEFYRA.SINALLASOMENOI, AddressOf SINALLASOMENOI_FILTER.Filter) strlist = New Csla.SortedBindingList(Of SINALLASOMENOI_EC)(FLTVPELATES ) Me.GEFYRA1BindingSource.DataSource = mGEFYRA Me.SINALLASOMENOIBindingSource.DataSource = strlistEnd Sub
Private Sub RebindUI(ByVal saveObject As Boolean, ByVal rebind As Boolean) Me.GEFYRA1bidingSource.RaiseListChangedEvents = False Me.SINALLASOMENOIBindingSource.RaiseListChangedEvents = False Try
UnbindBindingSource(
Me.SINALLASOMENOIBindingSource, saveObject, False)UnbindBindingSource(
Me.GEFYRA1bidingSource, saveObject, False) Me.SINALLASOMENOIBindingSource.DataSource = Me.GEFYRA1bidingSource ' save or cancel changes If saveObject ThenmGEFYRA.ApplyEdit()
Try Dim temp As GEFYRA1 = mGEFYRA.Clone()mGEFYRA = temp.Save()
Catch ex As Csla.DataPortalExceptionMessageBox.Show(ex.BusinessException.ToString(), _
"Error saving", MessageBoxButtons.OK, _MessageBoxIcon.Exclamation)
Catch ex As ExceptionMessageBox.Show(ex.ToString(), _
"Error Saving", MessageBoxButtons.OK, _MessageBoxIcon.Exclamation)
End Try ElsemGEFYRA.CancelEdit()
End If ' rebind UI if requested If rebind ThenBindUI()
End If Finally '// rebind the UIGEFYRA1bidingSource.DataSource = mGEFYRA
' restore events GEFYRA1bidingSource.RaiseListChangedEvents = True Me.SINALLASOMENOIBindingSource.RaiseListChangedEvents = True If rebind Then ' refresh the UI if rebinding Me.GEFYRA1bidingSource.ResetBindings(False) Me.SINALLASOMENOIBindingSource.ResetBindings(False) End If End Try End SubCopyright (c) Marimer LLC