Nested Data Grid Post Back Event

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top