J
Jeremy Martin
Hi I have a nested datagrid event and I get the onItemCommand event to
fire correctly however the dataItem does not get re-created on PostBack.
Basically i need to update a database and re-databind the child grid
with new values.
However as I have a child grid per row of the parent grid I need a way
to know the primarykey to be able to update the correct records "Hope
this makes sense"
Any help appreciated.
//CREATE THE CHILD GRID IN PARENT GRID TEMPLATE COLUMN
procedure TItemTemplate.InstantiateIn(container: System.Web.UI.Control);
begin
myPriContiuum := TPRIContinum.Create;
myTbl.Rows[0].Cells[2].Controls.Add(myPriContiuum);
aHL.Controls.Add(myTbl);
aHL.EnableViewState := True;
container.Controls.Add(aHL);
container.EnableViewState := True;
end;
//WIRE UP THE EVENTS
procedure TParentGrid.OnItemCreated(Sender: TObject;
E: DataGridItemEventArgs);
var
myPriContiuum : TPRIContinum;
begin
If (e.Item.ItemType = ListItemType.Item) OR (e.Item.ItemType =
ListItemType.AlternatingItem) OR (e.Item.ItemType =
ListItemType.SelectedItem) Then
Begin
myPriContiuum := (e.Item.FindControl('PriContinuum') as
TPRIContinum);
if Assigned(myPriContiuum) then
Include(myPriContiuum.OnCohortChanged , self.OnCohortChanged);
End;
end;
fire correctly however the dataItem does not get re-created on PostBack.
Basically i need to update a database and re-databind the child grid
with new values.
However as I have a child grid per row of the parent grid I need a way
to know the primarykey to be able to update the correct records "Hope
this makes sense"
Any help appreciated.
//CREATE THE CHILD GRID IN PARENT GRID TEMPLATE COLUMN
procedure TItemTemplate.InstantiateIn(container: System.Web.UI.Control);
begin
myPriContiuum := TPRIContinum.Create;
myTbl.Rows[0].Cells[2].Controls.Add(myPriContiuum);
aHL.Controls.Add(myTbl);
aHL.EnableViewState := True;
container.Controls.Add(aHL);
container.EnableViewState := True;
end;
//WIRE UP THE EVENTS
procedure TParentGrid.OnItemCreated(Sender: TObject;
E: DataGridItemEventArgs);
var
myPriContiuum : TPRIContinum;
begin
If (e.Item.ItemType = ListItemType.Item) OR (e.Item.ItemType =
ListItemType.AlternatingItem) OR (e.Item.ItemType =
ListItemType.SelectedItem) Then
Begin
myPriContiuum := (e.Item.FindControl('PriContinuum') as
TPRIContinum);
if Assigned(myPriContiuum) then
Include(myPriContiuum.OnCohortChanged , self.OnCohortChanged);
End;
end;