I have a datagridview and it allows user to enter data on it. I want that if the value of the first Cell in current row is Null/Empty all other cells in the same row is set to readonly=true, once the user enter something in the first cell then set the other cell to readonly=false. I want this to happen every time a new row is added to the datagridview.
I already tried this in RowsAdded event of datagridview but its not setting to readonly.
if (dgvMaterials.Rows[e.RowIndex].Cells["ItemID"].Value == null)
{
dgvMaterials.Rows[e.RowIndex].Cells["Description"].ReadOnly = true;
dgvMaterials.Rows[e.RowIndex].Cells["Qty"].ReadOnly = true;
dgvMaterials.Rows[e.RowIndex].Cells["Cost"].ReadOnly = true;
}