c# datagridview adding check box to data column
I have a gridview that contains data. I want the user to be able to toggle certain data, which will trigger an event to the database.
I have implemented this, with a single check box column that toggles information for a row at a time.
however, I now have the need to be able to toggle specif开发者_如何学编程ic columns within each row. Is it possible to somehow include a checkbox in specific data cells or would I simply have to have a checkbox column next to each column that I want to toggle?
Thanks.
if you want to display more than one checkbox for a row (on one of the columns cells as your requirements) you can use the RowDataBound event of the gridview: it allows to change the value of the cell before the grid is rendered. Here's a sample : http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx
you can add a checkbox into a column of your dataGridView
just go to Add Column property
then select type of Column
to DataGridViewCheckBoxColumn
精彩评论