Add Checkbox to DataGridView at code behind.
-
I have a datagridview to show data. My datagridview is using datasource to binding data. Now my question is , How can i add a new column as checkbox in front of each row? ( means if i have 3 row of record, each row will have one check box ) and store a value to it ? and how i check this checkbox is checked or unchecked ? thanks.
Best regards, Chee ken
-
I have a datagridview to show data. My datagridview is using datasource to binding data. Now my question is , How can i add a new column as checkbox in front of each row? ( means if i have 3 row of record, each row will have one check box ) and store a value to it ? and how i check this checkbox is checked or unchecked ? thanks.
Best regards, Chee ken
You should add the checkbox to the datagrid as a template column. Then you will basically step through the datagrid looking to see if the control exists based on the ID you gave it in the template column and then DirectCast(item, Checkbox) and see if it is .Checked = True or not. I hope that helps. Cleako
-
You should add the checkbox to the datagrid as a template column. Then you will basically step through the datagrid looking to see if the control exists based on the ID you gave it in the template column and then DirectCast(item, Checkbox) and see if it is .Checked = True or not. I hope that helps. Cleako
hi, i wnt to write code that shuld be executed when user clicks on checkbox that is present as datagrid columne. where should i write the code.
priya
-
hi, i wnt to write code that shuld be executed when user clicks on checkbox that is present as datagrid columne. where should i write the code.
priya
Since you are changing the topic you should start your own thread. BUT, you just need to set a function name to be called in the OnClick event of the template column's checkbox. That function should be Protected instead of Private.
Cleako