Hi,
I am using Adapter and VS2005.
I have a gridview setup on a page using llblgenprodatasource2. When I load the page the griview binds correctly to the data and everything works fine. LivePersistence = true.
When editing I need to update some values in code. So when user changes say the name field and clicks the update link, I need to add the current date to an UpdateDate field and also the userid of the logged in user.
Now I was performing this in the GridView_RowUpdating event, the updatedate field updated correctly but the userid field was not being updated. I then hooked up the PerformWork event and setup the changes in this event as below:
protected void LLBLGenProDataSource2_1_PerformWork(object sender, PerformWorkEventArgs2 e)
{
// --
foreach (UnitOfWorkElement2 l in e.Uow.GetEntityElementsToUpdate())
{
if (l.Entity.LLBLGenProEntityTypeValue == (int)EntityType.TourOperatorEntity)
{
TourOperatorEntity t = (TourOperatorEntity)l.Entity;
t.UpdatedDate = System.DateTime.Now;
t.FkuserId = Utility.GetUserId(this);
}
}
e.Uow.Commit(LLBLGenProDataSource2_1.AdapterToUse, true);
LLBLGenProDataSource2_1.Refetch = true;
CGridView1.DataBind();
}
In this I am updating the touroperatorentity properties and then commiting the changes.
The problem is that the performwork event is not firing. Now I maybe missing something small.
Regards
Hameed.