Hi,
I am populating data in datagridview control once the form loads. The first column of every row of the datagridview control is having one check box.
One checkbox i have used outside of the datagridview. What i want is if i check the outside checkbox, all the rows of the datagridview control having checkbox should have checked. Plz Help me Out..
Thank U in advance.
Loading
Kirtan PatelPosted May 10, 2009, 10:14 AM
in ur case its 1st Column Use Cell[0]
private void chkCheckAll_CheckedChanged(object sender, EventArgs e)
{
if (chkCheckAll.Checked == true)
{
foreach (DataGridViewRow dr in dataGridView1.Rows)
{
dr.Cells[1].Value = true;
}
}
else if(chkCheckAll.Checked == false )
{
foreach (DataGridViewRow dr in dataGridView1.Rows)
{
dr.Cells[1].Value = false ;
}
}
}
Here is Source Code file if you Not Getting it By code
http://www.mediafire.com/?sharekey=2e9d884c2476e3fad2db6fb9a8902bda
Happy Coding :)