Search code examples
c#infragistics

Condition to get specific cell value in ultragrid


I am trying to make some cells readonly on specific condition(flag). But i'm having problem to set the exact condition. I have a not null bit column and trying to set condition on its value. Here is my code :

private void grdOtherItemsInfo_InitializeLayout(object sender, InitializeLayoutEventArgs e)
    {
        UltraGridBand band;
        try
        {
            band = e.Layout.Bands[0];

            band.ColHeaderLines = 2;
            foreach (UltraGridRow row in **can't find right option**)
            {
                if (row.Cells[OtherItemStoreRequisitionForBatchChild.IsAutoDispense].Value.ToString() == "1")
                {
                    band.Columns[OtherItemStoreRequisitionForBatchChild.IsAutoDispense].CellActivation = Activation.ActivateOnly;
                    band.Columns[OtherItemStoreRequisitionForBatchChild.IndentedUOM].CellActivation = Activation.ActivateOnly;
                    band.Columns[OtherItemStoreRequisitionForBatchChild.IndentedQty].CellActivation = Activation.ActivateOnly;
                }
            }
    }

Solution

  • foreach (UltraGridRow row in grdOtherItemsInfo.Rows)
            {
                foreach (UltraGridRow urow in grdChemicalItemInfo.Rows[row.Index].ChildBands[0].Rows)
                {
                    if (Convert.ToBoolean(urow.Cells[OtherItemStoreRequisitionForBatchChild.IsAutoDispense].Value))
                    {
                        foreach (UltraGridCell col in urow.Cells)
                        {
                            col.Activation = Activation.ActivateOnly;
                        }
                    }
                }
            }