lundi 9 mars 2015

How to tick all checkboxes

I have a gridview control on my form.Its first column is checkboxcolumn and the other one textboxcolumn.I am populating Textbox columns with some string values coming from list


like this way



for (int i = 0; i < listeList.Count; i++)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells[1].Value = listeList[i];
}


What am i trying to do is to select all the checboxes in the gridview once the user click button How can I do this


Here is what I have tried



private void btnselectAll_Click(object sender, EventArgs e)
{


foreach (DataGridViewRow row in dataGridView1.Rows)
{

// row.Cells[0].Value = "true";

//if (row.Cells[0].Value != ull)
//{
// if (Convert.ToBoolean(row.Cells[0].Value))
// {
// MessageBox.Show(row.Cells[1].Value.ToString());
// }
//}

}

}

Aucun commentaire:

Enregistrer un commentaire