Ok I have a good idea of what I need to have happen here unfortunately i have tried many things to try and make it happen.
Here is what I think should be happening as I have livepersistence=false then I have to manually persist the Entity or collection. Handle the events such as perform work and perform select.
I have perform work working. I get a customer record inserted into my db and I have a control on my page a hiddentextbox named CustomerCrid that gets set to the Primary key of the newly created item. I have verified manually that the hidden field is getting a value set to the control and that it does match the primary key of the newly created tuple in the db.
I now am trying to display the item.
My page load method works as it should as well. If First load to page set formview to insert otherwise create the predicate to use as the filter.
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'In case I want to use a queryStrings in the future for a different use case
'If no keys then use case is adding a new connectivity request for services.
If Not Request.QueryString.HasKeys Then
If Not Page.IsPostBack Then
'this is first time access so workflow requires an insert.
'MsgBox("No Keys")
customerFV.ChangeMode(FormViewMode.Insert)
End If
If Page.IsPostBack Then
'Not first access to page so show inserted item should be
'Example SQL command would be get * from customer where CRID = customerCRID.Text
Dim bucket As New RelationPredicateBucket
bucket.PredicateExpression.Add(CustomerFields.Crid = customerCRID.Text)
customerDS_A.FilterToUse = bucket
End If
End If
End Sub
Right now the entitycollection held by the datasourceobject2 has a count of 0.Perfect. I have the following code in my perform select method and I am getting the msgboxes to popup. Of course eventually I wo't need them. Keep in mind I am coding in VB.
Sub CustomerDS_A_PerformSelect(ByVal sender As Object, ByVal e As PerformSelectEventArgs2) Handles customerDS_A.PerformSelect
MsgBox(customerDS_A.FilterToUse.PredicateExpression.Count.ToString)
MsgBox("Count of Collection " & customerDS_A.EntityCollection.Count.ToString)
End Sub
Which yields a message box showing "1" then a message box which shows "Count of Collection 0"
Which tells me that I need to clear or reset the Collection and then refetch it and bind it to the formview so it will display.
I have looked and looked for a method which would perform the refetch.
Otis you stated to do the following.
Use:
e.ContainedCollection.GetMulti(e.Filter, e.MaxNumberOfItemsToReturn, e.Sorter, e.Relations, e.PrefetchPath, e.PageNumber, e.PageSize);
where 'e' is the event args of the event
This doesn't exist??
I get the following error
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'GetMulti' is not a member of 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityCollection2'.
walaa you state to do the following dataSource.Refetch() & formView.DataBind()
great so in vb I would state ds.refetch = true which would mark the object to be refetched if LIVEPERSISTENCE=TRUE which it is not.
then you state to fv.databind() which gets me into my performselect method.
?????? What am I missing I wish I had the source code for the SD.LLBLGen.Pro.ORMSupportClasses so that I could dig into them and read and look and see what they are doing there. I don't mean to say that I would change them I think everything is fine I just think I am missing something really simple.
Thanks
Jeff