I have a grid where I have a checkbox in the first cell of the header control and I need to be able to track position from the checked/unchecked event handler from the check box control so I can check all /uncheck all child rows per level.
Unfortunately I cannot access a parent row or child rows form the header row.
this is the code I've tried and it does not work
try { CheckBox box = sender as CheckBox; HeaderCellControl cell = (box).Parent as HeaderCellControl; HeaderRow r = cell.Cell.Row as HeaderRow; bool valtoPass = (bool)box.IsChecked; Row activeRow = (Row)grdOLAPObjects.ActiveCell.Row; if (activeRow.ParentRow != null) { try { OlapObjectInformation selectedCatalog = activeRow.ParentRow.Data as OlapObjectInformation; selectedCatalog.Cubes.ForEach(p => p.Active = valtoPass); } catch { } } }picture of grid
actually the Manager object has a Parentrow property which is what I was looking for so besides the code tht is provided in the example (which works) I can also access it my original way now by going thru the Manage instead of the Active row so both of these snippets now work
thank you!
OlapObjectInformation selectedCatalog = cell.Cell.Row.Manager.ParentRow.Data as OlapObjectInformation; selectedCatalog.Cubes.ForEach(p => p.Active = valtoPass);
code form other thread
foreach (RowBase row in cell.Cell.Row.Manager.Rows) { if (row.RowType == RowType.DataRow) { ((OlapObjectInformation)row.Data).Active = (bool)box.IsChecked; } }
Hi,
You could take a look at this post: http://es.infragistics.com/community/forums/p/60063/355979.aspx#355979
There's a code snippet for achieving something similar.
Hope this helps,