Hello mcseidel ,
I apologize about the delayed answer.
Adding additional elements after the container grid is not supported out of the box. Making changes to the child grid however will trigger updating events like it does for the parent grid.
So in that event you can update the data source of the grid. As for triggering a call to the server. If you have activation behavior enabled the updating will trigger on every cell value changing after you change the active cell. Otherwise if you’ve enabled batch updating any page postback will trigger the updating event.
For editing of only some of the cells you’ll need to enable editing behavior for the child band (container grid you created) and set the EditingColumnSettings correspondingly with ReadOnly to true for the columns that should not be editable and ReadOnly to false for the ones that should be editable.
Please refer to the attached sample and let me know if you have any further questions.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Thanks, that was helpful. I'm moving in the same direction of setting individual behaviors on the instance of the child grid and might ask couple of questions withing this post framework later.
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.
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....
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.
The RequestFullAsyncRender did the job to persist updating the child grid I’m also trying to update parent grid with the child’s total amount value and need some help to sequence events :In the whdg_RowUpdating if I would add to your sample the following : islandType3Tbl.Rows[0][4] = 1300; then amount column get updated and persisted, and custom sum get recalculated, so it works perfect... now I’m trying to get this recalculated summary value and put it into the parent row, something like : ExhibitLR2MasterDS mDS = (ExhibitLR2MasterDS)Session["data"]; mDS.MasterTable.Rows[1][4] = 1201;where 1201 is the summary for the amount field in the child grid. Can you help me with the following :1. On the server side how to access summary value , seems like something as grid.Behaviors.SummaryRow...?? but what exactly ?2. What to do with parent grid right within whdg_RowUpdating so the parent row also would show new value and parent grid total get recalculated. I tried to do the same as for child grid ( clear datasource, get new one, etc. ) and it did not work. Can you advise and/or maybe update the your version of the site : whdg_LoadOnDemandEdit01_Modified.zip
Make sure that you make the changes for the parent grid directly to the WebHierachicalDataGrid instance. Otherwise the approach is the same.
I tested it by setting a value of 1 to the first row’s Amount column and it got recalculated and persisted as expected.
You can get the summary result from the SummaryCalculated event from the event args:
protected void whdg_SummaryCalculated(object sender, SummaryEventArgs e)
{
var value = e.SummaryValue;
}
You can’t directly access it fromthe behavior.
Please refer to the attached sample and let me know if you have any questions.
Updating Main Grid.Maya, I looked at you sample and it does updates the main grid value as expected. But my scenario is different. I have problem updating main grid right after changes done to child grid in RowUpdating event. If event triggered by main grid then it is not a problem e.g. after line mr.Amount = 95000; executed I can see changes on the main grid, if I try to do the same in the child grid section of the same event it’s not working even if I DataBind main grid again. This is the place where mr.Amount = 35000; got executed. The issue that I do not know how to address is the following : MainGris get binded on the PageLoad that executed before RowUpdating event, so when value in the master source changed ( mr.Amount = 35000) it could be seen only on the next postback (after any other child grid get expanded). So somehow if the change occured in main grid and new value assign to underline source (mr.Amount = 95000) then changes can be seen, if event triggered by child grid then changes to main grid ( mr.Amount = 35000) can be seen only after another postback. Can you advise how to make mr.Amount = 35000 visible without postback.Project attachedThanks.