Hi Otis
Thanks for your input. At least I understand now that I can't interfere in the communication between datasource and grid. Apparently, the ExecuteXXX methods are always fired.
I checked what version I'm running. It's 2.0.7.424. I think that's one of the latest.
As I use the infragistics grid I can't be sure if the problems don't come from that grid. So I tried the same with the standard MS grid. It doesn't work as expected as well. The example is very easy:
User control:
<llblgenpro:LLBLGenProDataSource2 ID="dataSource"
runat="server"
AdapterTypeName="CH.KochIT.KERPS.Data.DatabaseSpecific.DataAccessAdapter, CH.KochIT.KERPS.DataDBSpecific"
CacheLocation="Session"
DataContainerType="EntityCollection"
EntityFactoryTypeName="CH.KochIT.KERPS.Data.FactoryClasses.InvoiceItemEntityFactory, CH.KochIT.KERPS.Data"
LivePersistence="False"
OnPerformSelect="dataSource_PerformSelect"
OnPerformWork="dataSource_PerformWork">
</llblgenpro:LLBLGenProDataSource2>
Invoice items:
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="dataSource"
>
<Columns>
<asp:CommandField ShowEditButton="True"/>
<asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id" Visible="false"/>
<asp:BoundField DataField="Position" HeaderText="Position" SortExpression="Position" />
</Columns>
</asp:GridView>
And the code behind:
public partial class Modules_Invoices_DetailTabs_InvoiceItems : BaseUserControl {
public InvoiceEntity Invoice {
get { return (InvoiceEntity)((IParentDialogPage)Page).Entity; }
}
protected void dataSource_PerformSelect(object sender, PerformSelectEventArgs2 e) {
dataSource.EntityCollection = Invoice.InvoiceItem;
}
protected void dataSource_PerformWork(object sender, PerformWorkEventArgs2 e) {
// let this be empty for this test.
}
}
This user control is placed on a normal aspx page.
I tried the following workflow
1. Load page --> Grid is loaded with correct entities
2. Edit an entity (click on corresponding link in grid) --> Page switches to edit mode
3. Change value and click on update (click on corresponding link in grid)
4. Grid is empty!!!!! ???
Then I tried the same workflow as described above but for the data source I changed CacheLocation="ViewState".
Now the difference is that in point 4 the grid is not empty but my changes are not applied.
I also tried the same code in an empty aspx page (without using a user control) --> same result.
What's wrong with my code??? I checked the LLBLGen documentation again (Databinding with ASP.net 2.0, Adapter) but the example there uses LivePersistence = true and that also works fine on my side.
Thanks for your help.