Hi
Gone back to basics....two fields, one button...field accepts an ID, button goes and gets BO and populates field2. Using latest Codesmith templates (3.0).
here is my "Asynchronous Root Factory Method"
Public Shared Sub GetByProductIdAsync(ByVal productId As System.String, ByVal handler As EventHandler(Of DataPortalResult(Of Product)))
Dim dp As New DataPortal(Of Product)()
AddHandler dp.FetchCompleted, handler
Dim criteria As New ProductCriteria()
criteria.ProductId = productId
dp.BeginFetch(criteria)
End Sub
Button behind code is....
Private Sub LoadData(ByVal ID As String)
Dim bo As Business.Product = Business.Product.GetByProductIdAsync(ID,?????????? )
ProdDesc.Content = bo.Description
End Sub
Hi,
Basically - you need to supply the address of a sub to be called when the async Fetch is completed:
Private Sub LoadData(ByVal ID As String)
Business.Product.GetByProductIdAsync(ID, AddressOf FetchCompleted)
End Sub
Private Sub FetchCompleted(ByVal sender As Object, ByVal e As Csla.DataPortalResult(Of Product))
If e.Error IsNot Nothing Then
' an execption occured - notify the user
Else
ProdDesc.Content = e.Object.Description
End If
End Sub
Thanks Jonny, just managed to sort myself as well......it's good to know I was on the right lines...thankls once again
Copyright (c) Marimer LLC