Click here to Skip to main content
Rate this: bad
good
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
abel406288
Comments
Sergey Alexandrovich Kryukov at 24-Jan-13 16:13pm
   
What did you try? It looks trivial, as the selecting/selected events are available.
—SA

1 solution

Rate this: bad
good
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";
dataGridView1.Columns.Add(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.
  Permalink  
v2

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



Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2014
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