Hello there
I'm using LLBLGenPro 2.0.0.0 Final
I have a user control in which I want to edit data.
I have a LLBLGenProDataSource and FormView where I work with :
<llblgenpro:LLBLGenProDataSource ID="LLBLGenProDataSource1" runat="server" DataContainerType="EntityCollection"
EntityCollectionTypeName="IDB.DigiOffice.DAO.CollectionClasses.PersoonCollection, IDB.DigiOffice"
CacheLocation="Session" OnPerformSelect="dsrPersoon_PerformSelect" LivePersistence="false" OnPerformWork="dsrPersoon_PerformWork" EnableViewState="true">
</llblgenpro:LLBLGenProDataSource>
<asp:FormView ID="FormView1" runat="server" DataSourceID="dsrPersoon" DataKeyNames="ID" DefaultMode="Edit">
<EditItemTemplate>
<table style="width: 100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Label ID="lblZoekNaam" runat="server" Text="Zoeknaam"></asp:Label></td>
</td>
<td>
<asp:TextBox ID="txtZoekNaam" runat="server" Text='<%# Bind("ZoekNaam") %>'></asp:TextBox>
</td>
<td>
<asp:Label ID="lblVoornaam" runat="server" Text="Voornaam"></asp:Label></td>
<td>
<asp:TextBox ID="txtVoornaam" runat="server" Text='<%# Bind("Voornaam") %>'></asp:TextBox>
</td>
<td>
<asp:Label ID="lblGeboorteDatum" runat="server" Text="Geboortedatum"></asp:Label>
</td>
<td>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtGebDatumPartner" Format="dd-MM-yyyy"></ajaxToolkit:CalendarExtender>
<asp:TextBox ID="txtGebDatumPartner" runat="server" Text='<%# Bind("PartnerGebDatum", "{0:d}") %>'></asp:TextBox>
</td>
</tr>
</table>
<asp:button id="UpdateButton" runat="server" causesvalidation="True" commandname="Update" text="Update" />
<asp:button id="CancelButton" runat="server" causesvalidation="False" commandname="Cancel" text="Cancel" />
</EditItemTemplate>
</asp:FormView>
And here is the code behind
protected void dsrPersoon_PerformSelect(object sender, PerformSelectEventArgs e)
{
PersoonCollection pc = new PersoonCollection();
PredicateExpression filter = new PredicateExpression();
filter.Add(PersoonFields.ID == RecID);
pc.GetMulti(filter);
dsrPersoon.EntityCollection = pc;
}
protected void dsrPersoon_PerformWork(object sender, PerformWorkEventArgs e)
{
List<UnitOfWorkElement> uowElement = null;
PersoonEntity pers = null;
uowElement = e.Uow.GetEntityElementsToUpdate();
if (uowElement.Count > 0)
{
pers = uowElement[0].Entity as PersoonEntity;
pers.Save();
}
}
RecID is a int which is set through a QueryString Parameter
Now my problem is, when I update the record, changes are not saved.
For example : I change someone-s Voornaam.
When I inspect the UnitOfWork entity, its Voornaam property is not the new value as I entered it in my browser.
Can you please tell me what I'm doing wrong.
Oh, the datasource is a self-servicing one.
Thanks in advance !!