I'm binding a datatable to a gridview control, and when I format each column I need to format the data based on whether that column has a particular custom attribute. In this case, a column can represent:
- a text box (in which case I just display the text from the textbox in the gridview),
- a checkbox (in which case I display "Checked" or "Unchecked" based on whether the column's underlying data value is 1 or 0),
- a radio button (in which case I display "On" or "Off" based on whether the column's underlying data value is 1 or 0).
The problem is that the column data types are all strings in the untyped data table being bound to the grid, currently. And the binding uses autoGenerateColumns. So:
- How do I flag a column as being either a radio, a textbox, or a checkbox?
- How do I access that "flag" while binding to the grid to show the text, "Checked/Unchecked", or "On/Off"?
I hope I asked this right. Phew!