Not sure why setting the ReadOnly property of the row doesn't work (I am still able to edit all the rows) as I am looping through each row in DataGridView:
foreach (DataGridViewRow row in dataGridEthnicityData.Rows)
{
string EthnicityProfilingCompanyName = row.Cells["EthnicityProfilingCompanyName"].Value.ToString();
string EthnicityProfilingCompanyID = row.Cells["EthnicityProfilingCompanyID"].Value.ToString();
if (EthnicityProfilingCompanyName != ProfilingEntityName && EthnicityProfilingCompanyID != ProfilingEntityID)
row.ReadOnly = true;
else row.ReadOnly = false;
}
Appreciate if any one can point me to the right direction. Do I have to change how I loop? I'm thinking to make use of a loop with counter so I can use it as row index.
Thank you.