Hello, I am using LLBLGenProDataSource2 for data binding in asp.net 2.0 project:
version 2.6 Final ( SD.LLBLGen.Pro.ORMSupportClasses.NET20 is version 2.6.8.612).
I have an addition on my PlaceCustumer entity (PlaceCustumerEntity.cs):
public CustumerAttributes Attributes
{
get
{
if (_attributes == null)
{
_attributes = CreateAttributesObject();
}
return _attributes;
}
set
{
if (value != _attributes)
{
_attributes = value;
}
}
}
In my form I have the following code:
<llblgenpro:LLBLGenProDataSource2 ID="ldsCustumerEntity" runat="server"
OnPerformWork="Lds_OnPerformWork"
OnPerformSelect="Lds_OnPerformSelect"
DataContainerType="EntityCollection" LivePersistence="false"
CacheLocation="Session"
AdapterTypeName="Place.DAL.DatabaseSpecific.DataAccessAdapter, Place.DALDBSpecific"
EntityFactoryTypeName="Place.DAL.FactoryClasses.PlaceCustumerEntityFactory, Place.DAL">
</llblgenpro:LLBLGenProDataSource2>
<asp:FormView ID="FormView1" DataSourceID="ldsCustumerEntity"
DataKeyNames="Id"
DefaultMode="Edit" runat="server">
<EditItemTemplate>
<asp:TextBox ID="TxtPlace" runat="server" Text='<%# Bind("Place") %>' />
<asp:TextBox ID="TxtName" runat="server" Text='<%# Bind("Attributes.NameCustomer") %>' />
<asp:Button ID="btnSubmit"
OnClick="btnSubmit_Click"
CommandName="Update" runat="server" Text="Save" />
</EditItemTemplate>
</asp:FormView>
In the C# code this:
ListItemViewModel< PlaceCustumerEntity> _selectedItem;
public void LoadData(ListItemViewModel< PlaceCustumerEntity> selectedItem)
{
if (selectedItem != null)
{
_selectedItem = selectedItem;
ldsCustumerEntity.Select();
}
}
protected void Lds_OnPerformSelect(object sender, PerformSelectEventArgs2 e)
{
if (_selectedItem != null)
{
ldsCustumerEntity.EntityCollection.Clear();
ldsCustumerEntity.EntityCollection.Add(_selectedItem.Entity);
}
}
When asp run the code, data binding works. LoadData() is called data "Attributes.NameCustomer" and "Place" are correctly displayed in the form. This works has expected. Then I have changed the field "Place", and the property "Attributes.NameCustomer" using the web form. Now the problem: when I click on the save button, entity is changed, but only on the field "Place". The entity property "Attributes.NameCustomer" is unchanged.
Does Bind only apply on entity fields that are mapped on the database and not on custumer properties? After I have modified "Attributes.NameCustomer" the form disappear when I click the save button.