Hi,
I am using the WHDG to display hierarchical machine related data. I have the requirement to let the user select any two rows and click a compare button, so that the two rows can be compared and results displayed.
When two parent rows are selected, I can retrieve the rows using
WebHierarchicalDataGrid1.GridView.Behaviors.Selection.SelectedRows
But this returns null when two child rows are selected. Could yoy please help me retrieve the selected child rows?
Help will be massively appreciated as I have been breaking my head over this for a while now!
Hi sasha143,
Each row island in the WHDG has its own set of behaviors copied from the Band. The selected rows are stored per grid. In order to get the total selected rows, you would have to write a recursive function to look through all row islands and return the rows.
regards,David Young
I am doing the following to go into every rowisland and get the selected child bands:
for (int i = 0; i < WebHierarchicalDataGrid1.GridView.Rows.Count; i++) { Infragistics.Web.UI.GridControls.ContainerGridRecord rowscontainer = WebHierarchicalDataGrid1.GridView.Rows[i]; for (int j = 0; j < rowscontainer.RowIslands.Count; j++) { Infragistics.Web.UI.GridControls.ContainerGrid childgrid = rowscontainer.RowIslands[j]; src1 = childgrid.Behaviors.Selection.SelectedRows; }
However, everytime I store the selected rows of a rowisland into the variable src1, it gets rewritten and the previous results dont stay. Could you please tell me how I can store the previous selection before reassigning src1, so that in the end i have all the selected rows at one place for manipulation?
Hello,Sorry for the late answer. I created a sample which goes through the child grids recursively and stores the selected rows into a List. I hope that helps.Regards,Nikolai Dimitrov