Hello mcseidel ,
Over updating and other postbacks you should not recreate the rowisland if it’s already created. So make sure that when you update a row that you make a check whether a rowisland already exists in the RowIslandsPopulating event. Also make sure that you set the data source in the RowUpdating event and databind. Also you may have to invoke the RequestFullAsyncRender() method for the changes to be reflected on the client.
Please refer to the attached working sample. In it I change the description of the first child row to “Value” and the change gets persisted.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Maya, this dynamic grid does not go easy on me ..Here the problem :I modified sample as following in order to have edited values on screen: in Page_Load I’ve stored DS into session // store original dataset in session if (!IsPostBack) {…...................................... // store original dataset in session Session.Remove("LR2MasterDS"); Session["LR2MasterDS"] = MasterDS; Session.Remove("LR2DetailsDS"); Session["LR2DetailsDS"] = DetailsDS; whdg.DataSource = MasterDS; whdg.DataBind(); } else whdg.DataSource = (ExhibitLR2MasterDS)Session["LR2MasterDS"]; in the whdg_RowIslandsPopulating - get the datasource from session :
ExhibitLR2DetalsDS DetailsDS = (ExhibitLR2DetalsDS)Session["LR2DetailsDS"];ExhibitLR2DetalsDS.type3tblDataTable islandType3Tbl = DetailsDS.type3tbl;when it gets bind It uses datasource updated in the new added RowUpdating IslandGrid.DataSource = islandType3Tbl;IslandGrid.DataBind();protected void whdg_RowUpdating(object sender, RowUpdatingEventArgs e) { GridRecord gr = e.Row; ContainerGrid g = (ContainerGrid)sender; ControlDataField a = g.FindColumn("idLR5Detail"); if (a != null) { int idMaster = (int) e.Values["idMaster"]; int idRec = (int) e.Values["idRec"]; int newAmnt = (int) e.Values["Amount"]; int oldAmnt = (int)e.OldValues["Amount"]; int nType = (int) e.Values["Ntype"]; int dfrnce = (newAmnt - oldAmnt) * ((nType == 1) ? 1 : -1); ExhibitLR2DetalsDS DetailsDS = (ExhibitLR2DetalsDS)Session["LR2DetailsDS"]; ExhibitLR2MasterDS MasterDS = (ExhibitLR2MasterDS)Session["LR2MasterDS"]; ExhibitLR2DetalsDS.type3tblRow dr = DetailsDS.type3tbl.FindByidRec(idRec); dr.Amount = newAmnt; ExhibitLR2MasterDS.MasterTableRow mr = MasterDS.MasterTable.FindByidMaster(idMaster); mr.Amount = mr.Amount + dfrnce; Session["LR2DetailsDS"] = DetailsDS; Session["LR2MasterDS"] = MasterDS; whdg.DataSource = MasterDS; whdg.DataBind(); } else { ExhibitLR2MasterDS MasterDS = (ExhibitLR2MasterDS)Session["LR2MasterDS"]; int idMaster = (int)e.Values["idMaster"]; int newAmnt = (int)e.Values["Amount"]; ExhibitLR2MasterDS.MasterTableRow mr = MasterDS.MasterTable.FindByidMaster(idMaster); mr.Amount = newAmnt ; Session["LR2MasterDS"] = MasterDS; whdg.DataSource = MasterDS; whdg.DataBind(); }Here is the problem : After row updated it is posting back and after page_load comes to RowUpdating where Datasources get midfield. Parent grid get databind and then it goes to RowIslandsPopulating where it retrieves the updated DetailsDS from session and does DataBind at the end. I’m checking in debugger contents of islandGrid.DataSource = islandType3Tbl; table right before next line ( islandGrid.DataBind(); ) and it is updated table with new values, but in the browser it shows old value. Also the value of the parent grid datasource get modified and it is also reflected in Datasource (MasterDS.MasterDStbl) but old value still shows up. Is it get cashed somewhere ? How I can turn it off ? When the same done to parent grid it goes through the same path, just different branch of RowUpdating and value in browser is new, means it works properly....
I’m still awaiting for confirmation on the issue with the registering of events for the new row island but in the meantime I can suggest that you handle the event of the whole grid.
You can determine which container grid has invoked the event by checking the ContainerGrid IslandGridLoc for example for the DataKeyFiedls. If it’s the parent it would be “idMaster” and if it’s the child it would be “idRec”. So you can determine what custom summary to return based on that.
Please refer to the slightly modified sample and let me know If you have any questions.
Little add on on previous post - If custom summary substituted by SummaryType.Sum; then it works fine, so the real question is where to attach CalculateCustomSummary after editing starts.
I still did not reach an end. I’m adding custom summary to the child (dynamic) grid and having problem that summary get recalculated, on editing.....The core of the problem is that child grid created dynamically during RowIslandPopulating event triggered apparently by clicking expansion sign as well as CalculateCustomSummary get initialized at the same token. When dynamic child grid get opened already and some value get changed it posting back but RowIslandPopulating not getting called anymore and CalculateCustomSummary consequently did not get initialized and blowing up.It is blowing up the same way if I edit cell and will try to close expanded child grid.So only one child grid can be open at any given moment and no editing involved then it worksSo, if expanded child grid getting rendered from the view state how I would insert (register) CalculateCustomSummary in this case ? Or any other approach to this problem ? I attached small test we site that manifest this problem. Thanks