I have a Datagridview within a windows form which loads data. I have also included a checkbox column to this Datagridview in run time. My question is how can i know if any of the checkboxs from the checkbox column has been checked, and if a checkbox has been checked enable a button. I have used CellValueChanged event to perform above task but unable to get the desired result.
This is what i have done
List<int> ChkedRow = new List<int>();
for (int i = 0; i <= Datagridview1.RowCount - 1; i++)
{
if (Convert.ToBoolean(Datagridview1.Rows[i].Cells["chkcol"].Value) == true)
{
button1.Enabled = true;
}
else
{
button1.Enabled = false;
}
}