Click here to Skip to main content
11,636,300 members (76,535 online)
Rate this: bad
Please Sign up or sign in to vote.
Hi fellows. I have a DataGridView control with a CheckBoxColumn in it, and a CheckBox on the Header. There are some articles regarding this topic , but, i want the DataGridView to behave like i said in the Subject, like yahoo or gmail when you select the checkbox of an email and the corresponding row gets selected too.Does anyone have some clues regarding this?

Thanks in advance!!!
Posted 24-Jan-13 9:26am
Sergey Alexandrovich Kryukov at 24-Jan-13 16:13pm
What did you try? It looks trivial, as the selecting/selected events are available.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

U can use below on form load event
DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
chk.HeaderText = "Check Data";
chk.Name = "chk";
then on to change coor on checkbox click put code on cellmouseclick.
if (dataGridView1.Rows[e.RowIndex].Cells["chk"].Value == true)
       for(int i=0;i < dataGridView1.Rows[e.RowIndex].Cells.Count; i++)
            dataGridView1.Rows[e.RowIndex].Cells[i].Style.BackColor = Color.Green;
hope it helps u out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 263
1 Sergey Alexandrovich Kryukov 254
2 stibee 249
3 Suvendu Shekhar Giri 225
4 OriginalGriff 183
0 OriginalGriff 8,941
1 Sergey Alexandrovich Kryukov 8,459
2 Mika Wendelius 6,849
3 F-ES Sitecore 2,364
4 Suvendu Shekhar Giri 2,320

Advertise | Privacy | Mobile
Web03 | 2.8.150728.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100