I have a scenario where the cell of a column in a grid with 7 bands is editable or read-only based on a condition. Also, if the child cell is editable then make the parent cell also editable but if all children cells are read-only then only make the parent cell read-only.
I am able to alter the Activation of a cell at the lowest band i.e. band = 7 but not for higher bands, it always stays as read-only. Below is the InitializeRow event code -
detailBand = 7;
if (e.Row.Band.Index == detailBand) { double manualVolume = Helper.ParseDoubleFromObject(e.Row.Cells["ManualVolume"].Value); int leaseNum = Helper.ParseIntFromObject(e.Row.Cells["LeaseNumber"].Value); int? volType = null; try { if (e.Row.Cells["VolumeType"] != null) volType = Helper.ParseIntFromObject(e.Row.Cells["VolumeType"].Value); } catch (System.ArgumentException ex) { if (ex.ParamName == "key" && ex.Message.Contains("Key not found")) volType = -1; else throw ex; } if (manualVolume == 0.0 && (leaseNum == 1 || leaseNum == 2 || leaseNum == 3 || leaseNum == 5 || leaseNum == 6 || volType == 8)) { e.Row.Cells["ManualVolume"].Activation = Activation.NoEdit; e.Row.Cells["ManualVolume"].Appearance.BackColor = Color.LightGray; } else { e.Row.Cells["ManualVolume"].Activation = Activation.AllowEdit; e.Row.Cells["ManualVolume"].Appearance.BackColor = Color.White; } } else { int? isEdit = Helper.ParseIntFromObject(e.Row.Cells["IsEdit"].Value); if (isEdit != null && isEdit > 0) { e.Row.Cells["ManualVolume"].Activation = Activation.AllowEdit; e.Row.Cells["ManualVolume"].Appearance.BackColor = Color.White; } else { e.Row.Cells["ManualVolume"].Activation = Activation.NoEdit; e.Row.Cells["ManualVolume"].Appearance.BackColor = Color.LightGray; } }
Am I missing something here? What other properties should I be on look out for which may prevent what I am trying to achieve?
Hello Priyam,
I am following up to see if the issue has been resolved or if you still need assistance with this.
I was able to resolve the issue myself. If possible you may delete this thread.