Click here to Skip to main content
15,908,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a gridview and in gridView i have checkbox and combobox.
i need to select particular item from combobox only if the check box is not ticked, if it is ticked it must not select it.

i used following code:

for (int i = 0; i <= GridView1.Rows.Count - 1;  i++)
                object obj = GridView1.Rows[i].Cells[0];
                if (((obj != null)))
                    DataGridViewCheckBoxCell checkBox1 = (DataGridViewCheckBoxCell)obj;
                    object objValue = checkBox1.Value;
                    if (((objValue != null)))
                        bool @checked = (bool)objValue;
                        if ((@checked))
                            SplitMethod.ReadOnly = true;
                            SplitMethod.ReadOnly = false;
know the problem if i select first row checkbox so it enable me to select rest of combobox as well.

each row in grid view has check box and combo box, so when i select each row check box so it must stop me to make changes to only that combobox not rest of the rows.
i must me able to make changes to other rows combobox if it check box is not selected.
Updated 25-Feb-13 21:16pm

1 solution


probably you need to use itemcommand event. and check the following link. it will may help you.[^]

Share this answer
ByakuyaKuchiki 26-Feb-13 3:34am    
i am working on windows form app.
i m displaying my data on grid view with two extra column name, checkbox and combobox column on each row.
i want when i tick checkbox it must not let me choose any thing from combobox for only that particular Row. but for rest of the rows with unselected check box i must be able to select value from combobox.

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900