Is there a way to retrieve whether a Checkbox field is checked in a databound gridview in ASP.NET? I can retrieve all other cell values in a foreach loop with cell.Text. Since it is databound (to an ObjectDataSource) the columns and cells don’t have explicitly set IDs and I can’t seem to find a property that would let me know the cell contains a checkbox or just text. All cells are of type DataControlFieldCell so I can’t check based on type either. Thoughts?
EDIT:
foreach (GridViewRow row in report_gv.Rows)
{
data += "<TR>";
foreach (TableCell cell in row.Cells)
{
data += "<TD>" + cell.Text + "</TD>";
//If this is a checkbox (bit value from the DB) cell.Text isn't going to return anything
}
data += "</TR>";
}
You can expand this to process however you need.